<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Compose file version 3 reference | Docker Docs
</title><meta name=description content="Find a quick reference for Docker Compose version 3, including Docker Engine compatibility, memory limitations, and more."><meta name=keywords content="[docker compose ports,docker compose version 3,docker-compose memory limit version 3,docker compose 3 memory limit]"><link rel=canonical href="index.html"><link rel=icon type=image/x-icon href="../../../assets/favicons/docs@2x.ico" sizes=129x128><link rel=apple-touch-icon type=image/x-icon href="../../../assets/favicons/docs@2x.ico" sizes=129x128><meta name=msapplication-TileImage content="https://docs.docker.com/assets/favicons/docs@2x.ico"><meta name=theme-color content="#2496ed"><meta name=twitter:title itemprop="title name" content="Compose file version 3 reference"><meta name=twitter:description property="og:description" itemprop=description content="Find a quick reference for Docker Compose version 3, including Docker Engine compatibility, memory limitations, and more."><meta name=twitter:card content="summary_large_image"><meta name=twitter:domain content="https://docs.docker.com"><meta name=twitter:site content="@docker_docs"><meta name=twitter:url content="https://twitter.com/docker_docs"><meta name=twitter:image:src content="https://docs.docker.com/assets/images/thumbnail.webp"><meta name=twitter:image:alt content="Docker Documentation"><meta property="og:title" content="Compose file version 3 reference"><meta property="og:description" content="Find a quick reference for Docker Compose version 3, including Docker Engine compatibility, memory limitations, and more."><meta property="og:type" content="website"><meta property="og:updated_time" itemprop=dateUpdated content="2024-02-09 10:46:27 +0100 +0100"><meta property="og:image" itemprop="image primaryImageOfPage" content="https://docs.docker.com/assets/images/thumbnail.webp"><meta property="og:locale" content="en_US"><meta property="og:url" content="https://docs.docker.com/compose/compose-file/compose-file-v3/"><meta property="og:site_name" content="Docker Documentation"><meta property="article:published_time" itemprop=datePublished content="2024-02-09 10:46:27 +0100 +0100"><script type=application/ld+json>{"@context":"https://schema.org","@type":"WebPage","headline":"\"Compose file version 3 reference\"","description":"\"Find a quick reference for Docker Compose version 3, including Docker Engine compatibility, memory limitations, and more.\"","url":"https:\/\/docs.docker.com\/compose\/compose-file\/compose-file-v3\/"}</script><script src=https://cdn.cookielaw.org/scripttemplates/otSDKStub.js type=text/javascript data-domain-script=8e0ebfd9-035d-4ec2-9b2f-a2de9c09f906></script><script type=text/javascript>function OptanonWrapper(){}</script><script>(function(e,t,n,s,o){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],i=t.createElement(n),r=s!="dataLayer"?"&l="+s:"";i.async=!0,i.src="https://www.googletagmanager.com/gtm.js?id="+o+r,a.parentNode.insertBefore(i,a)})(window,document,"script","dataLayer","GTM-WL2QLG5")</script><script>(function(e,t,n,s,o,i){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:3169877,hjsv:6},o=t.getElementsByTagName("head")[0],i=t.createElement("script"),i.async=1,i.src=n+e._hjSettings.hjid+s+e._hjSettings.hjsv,o.appendChild(i)})(window,document,"https://static.hotjar.com/c/hotjar-",".js?sv=")</script><link href="../../../assets/fonts/RobotoFlex.woff2" rel=preload as=font type=font/woff2 crossorigin><style>body>img{display:none}</style><link href="../../../css/styles.min.8767cc26123e21700c497beebf1cbd8dfdfec3499469fd8793a873c11b567264.css" rel=stylesheet><script>(()=>{function t(){let e=localStorage.getItem("theme-preference");return e||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}var e=t();document.firstElementChild.className=e==="dark"?"dark":"light",localStorage.setItem("theme-preference",e)})()</script><script defer src="../../../scripts.js"></script><link rel=preconnect href=https://3XRLW0LZH9-dsn.algolia.net crossorigin></head><body class="bg-background-light text-base dark:bg-background-dark dark:text-white"><header class="sticky top-0 z-20 h-16 px-4 text-white bg-gradient-to-r from-accent-light to-blue-light-500 dark:from-accent-dark dark:to-blue-dark-100"><div class="mx-auto flex h-full max-w-[1400px] items-center justify-between"><div class="flex h-full items-center gap-8 md:gap-2"><button x-data @click="() => {
      $store.showSidebar = ! $store.showSidebar;
      const sidebar = document.querySelector('#sidebar');
      if ($store.showSidebar) {
        sidebar.classList.replace('md:hidden', 'md:block');
      } else {
        sidebar.classList.replace('md:block', 'md:hidden');
      }
      }" class="icon-svg hidden px-4 md:block" aria-label=Menu><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M150-240q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T150-3e2h660q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T810-240H150zm0-210q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T150-510h660q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T810-450H150zm0-210q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T150-720h660q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T810-660H150z"/></svg></button><div><a title="Docker Docs home page" href="../../../index.html"><div><svg width="92" height="33" viewBox="0 0 92 33" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M31.4783 13.9171C30.6936 13.3542 28.6325 13.1137 27.1335 13.5441 27.0527 11.9527 26.2826 10.6119 24.8747 9.44209L24.3529 9.06908 24.0051 9.62859C23.3219 10.7333 23.0351 12.2054 23.1366 13.5441 23.2173 14.3684 23.4865 15.2954 24.0051 15.9686 22.0548 17.1748 20.2566 16.9011 12.2938 16.9011H.00279151C-.0334407 18.818.256417 22.505 2.4552 25.5056 2.69847 25.8367 2.96452 26.1578 3.25334 26.4668c1.7878 1.9092 4.48969 3.3085 8.53006 3.313C17.9471 29.7853 23.2277 26.234 26.4399 17.6471 27.4969 17.6659 30.2867 17.8491 31.6522 15.0361 31.6853 14.9886 32 14.2901 32 14.2901L31.4783 13.9171zM8.02461 11.9395H4.56805v3.6848H8.02461V11.9395zm4.46589.0H9.03394v3.6848H12.4905V11.9395zm4.4659.0H13.4998v3.6848h3.4566V11.9395zm4.4659.0H17.9657v3.6848h3.4566V11.9395zm-17.86461.0H.102171v3.6848H3.55873L3.55769 11.9395zM8.02357 7.28461H4.56702V10.9694H8.02357V7.28461zm4.46593.0H9.0329V10.9694h3.4566V7.28461zm4.4658.0H13.4988V10.9694h3.4565V7.28461zm0-4.65485H13.4988V6.31458h3.4565V2.62976z" fill="#fff"/><path d="M78.9658 8.41589C78.4538 8.41589 78.0459 8.81327 78.0459 9.30828 78.0459 9.81422 78.4538 10.2116 78.9658 10.2116 79.4827 10.2116 79.8801 9.81422 79.8801 9.30828 79.8797 8.81327 79.4823 8.41589 78.9658 8.41589zM78.9711 10.0216C78.5685 10.0216 78.2744 9.70606 78.2744 9.30868 78.2744 8.91697 78.5684 8.59575 78.9658 8.59575 79.3628 8.59575 79.6512 8.91697 79.6512 9.31435 79.6512 9.70606 79.3628 10.0216 78.9711 10.0216z" fill="#fff"/><path d="M79.1725 9.33586V9.32492C79.281 9.29211 79.3572 9.21636 79.3572 9.11793 79.3572 9.03083 79.3191 8.95995 79.2701 8.92227 79.2049 8.8842 79.1287 8.85706 78.9598 8.85706 78.8132 8.85706 78.6985 8.86799 78.6171 8.8846V9.77699H78.8241V9.41768H78.9217C79.0364 9.41768 79.0907 9.46143 79.1069 9.55906 79.134 9.66275 79.1502 9.74418 79.1777 9.77699H79.4009C79.3791 9.74418 79.3625 9.68989 79.3357 9.55379 79.3082 9.43348 79.2592 9.36826 79.1725 9.33586zM78.9274 9.27064H78.8298V9.01504C78.8517 9.00937 78.8893 9.0037 78.944 9.0037 79.0749 9.0037 79.1344 9.05838 79.1344 9.14021 79.134 9.23256 79.0416 9.27064 78.9274 9.27064z" fill="#fff"/><path d="M41.5015 10.32C42.47 10.32 43.285 9.9708 43.9785 9.27042 44.6631 8.57936 45.003 7.73518 45.003 6.73747V.752051C45.003.560855 44.9402.400849 44.8122.27568 44.6842.150511 44.5307.0869141 44.3463.0869141 44.158.0869141 44.0041.150511 43.8809.27568 43.7574.400849 43.697.560855 43.697.752051V3.94284C43.0639 3.41949 42.3327 3.15537 41.5015 3.15537 40.5354 3.15537 39.7086 3.50415 39.0244 4.20493 38.3399 4.90288 38 5.74746 38 6.73788 38 7.72829 38.3423 8.57045 39.0244 9.27082 39.7086 9.96877 40.533 10.32 41.5015 10.32zM39.4806 5.86736C39.5948 5.59394 39.7507 5.35778 39.946 5.15524 40.1416 4.9523 40.3746 4.79189 40.6399 4.67198 40.9076 4.55168 41.194 4.49294 41.5035 4.49294S42.0925 4.55168 42.3603 4.67198C42.628 4.79229 42.8585 4.9527 43.0566 5.15767 43.2547 5.36264 43.4106 5.60082 43.5244 5.86979 43.6387 6.1412 43.6966 6.4288 43.6966 6.73545 43.6966 7.04209 43.6383 7.33213 43.5244 7.6011V7.60596C43.4102 7.87736 43.2543 8.11554 43.0566 8.31808 42.8589 8.52346 42.626 8.68346 42.3603 8.80377 42.0925 8.92408 41.8085 8.98281 41.5035 8.98281S40.9076 8.92408 40.6399 8.80377C40.3721 8.68346 40.1416 8.52305 39.946 8.32011 39.7503 8.11716 39.5944 7.87898 39.4806 7.60798 39.3663 7.33456 39.3084 7.04452 39.3084 6.73788 39.308 6.43123 39.3663 6.1412 39.4806 5.86736z" fill="#fff"/><path d="M72.9696 8.97333C72.9696 8.78699 72.9092 8.62212 72.7853 8.49695 72.6621 8.37179 72.5062 8.30819 72.3198 8.30819 72.157 8.31305 72.0124 8.36692 71.8892 8.47548 71.6936 8.64521 71.4817 8.77484 71.2512 8.8599 71.0207 8.94497 70.7692 8.9871 70.4946 8.9871 70.2523 8.9871 70.0194 8.94943 69.7982 8.87165 69.5767 8.79388 69.3701 8.68774 69.1858 8.5484 68.9994 8.40905 68.839 8.24419 68.7017 8.04853 68.5644 7.85531 68.4595 7.64062 68.3898 7.40487H73.3418C73.5253 7.40487 73.6793 7.34127 73.8073 7.2161S73.9981 6.93093 73.9981 6.73973c0-.49541-.0862999999999943-.95517-.256-1.37726C73.5719 4.93795 73.3131 4.55353 72.9736 4.20921L72.9692 4.20678C72.2777 3.50883 71.4509 3.15723 70.4921 3.15723 69.5325 3.15723 68.6993 3.5064 68.0147 4.20678 67.3301 4.90473 66.9902 5.74932 66.9902 6.73973S67.3325 8.5723 68.0147 9.27268C68.6993 9.97062 69.5236 10.3222 70.4921 10.3222 71.372 10.3222 72.1331 10.0322 72.7804 9.45212 72.906 9.31966 72.9696 9.15966 72.9696 8.97333zM68.6924 5.43093C68.8301 5.2377 68.9925 5.07 69.1793 4.93106 69.368 4.79212 69.5726 4.68558 69.7986 4.60781 70.0243 4.53003 70.2547 4.49236 70.4925 4.49236 70.7299 4.49236 70.9604 4.53003 71.1836 4.60781 71.4072 4.68558 71.6126 4.79171 71.7961 4.93106 71.9824 5.07 72.1452 5.23527 72.2826 5.43093 72.4223 5.62415 72.5272 5.83884 72.5997 6.07459H68.3853C68.4526 5.84127 68.555 5.62658 68.6924 5.43093z" fill="#fff"/><path d="M75.3696 10.3222C75.5531 10.3222 75.7026 10.2562 75.8278 10.1265 75.9562 9.99692 76.0186 9.83894 76.0186 9.65747V6.74011c0-.3111.0582999999999885-.60357.1721-.8774C76.305 5.58928 76.4609 5.35312 76.6586 5.15058 76.8571 4.94764 77.0896 4.78723 77.3549 4.67178 77.6227 4.5539 77.9071 4.49476 78.2121 4.49476 78.5167 4.49476 78.8055 4.54904 79.0688 4.65517 79.1733 4.70216 79.2645 4.72606 79.3435 4.72606 79.4346 4.72606 79.5205 4.70945 79.5995 4.67421 79.6785 4.63897 79.7485 4.59157 79.8069 4.53041 79.8652 4.46924 79.9114 4.39835 79.9466 4.31572 79.9814 4.23551 80.0001 4.14842 80.0001 4.05404 80.0001 3.87013 79.9417 3.72147 79.8255 3.60602H79.8279C79.7117 3.49058 79.5646 3.40065 79.3876 3.33462 79.2106 3.26859 79.0174 3.22363 78.8055 3.19771 78.5957 3.17178 78.398 3.16003 78.2145 3.16003 77.7977 3.16003 77.4064 3.22849 77.0386 3.365 76.6708 3.50192 76.3305 3.69757 76.0186 3.95236V3.82517C76.0186 3.64127 75.9558 3.48571 75.8278 3.35568 75.7002 3.22606 75.5487 3.16003 75.3696 3.16003 75.1898 3.16003 75.0318 3.22606 74.9042 3.35568 74.7758 3.48531 74.713 3.64329 74.713 3.82517v5.8323C74.713 9.84137 74.7758 9.99692 74.9042 10.1265 75.0318 10.2562 75.1857 10.3222 75.3696 10.3222z" fill="#fff"/><path d="M52.4904 5.3649C52.3203 4.94281 52.0667 4.55596 51.7244 4.20678 51.0329 3.50883 50.2066 3.15723 49.2473 3.15723 48.2881 3.15723 47.4545 3.5064 46.7703 4.20678 46.0857 4.90473 45.7458 5.74932 45.7458 6.73973S46.0881 8.5723 46.7703 9.27268C47.4549 9.97062 48.2788 10.3222 49.2473 10.3222 50.2159 10.3222 51.0309 9.97305 51.7244 9.27268 52.409 8.58161 52.7488 7.73743 52.7488 6.73973 52.744 6.24472 52.6581 5.78699 52.4904 5.3649zM51.2703 7.60052V7.60538C51.1561 7.87678 51.0001 8.11497 50.8024 8.31751 50.6043 8.52288 50.3718 8.68288 50.1061 8.80319 49.8408 8.9235 49.5544 8.98224 49.2494 8.98224 48.9443 8.98224 48.6535 8.9235 48.3857 8.80319 48.118 8.68288 47.8875 8.52247 47.6918 8.31953 47.4962 8.11659 47.3402 7.8784 47.2264 7.6074 47.1122 7.33398 47.0543 7.04394 47.0543 6.7373 47.0543 6.43066 47.1126 6.14062 47.2264 5.86719 47.3406 5.59376 47.4966 5.35761 47.6918 5.15507 47.8875 4.95212 48.1204 4.79171 48.3857 4.67181 48.6535 4.5515 48.9399 4.49276 49.2494 4.49276 49.5588 4.49276 49.8383 4.5515 50.1061 4.67181S50.6043 4.95253 50.8024 5.1575C51.0005 5.36247 51.1565 5.60065 51.2703 5.86962 51.3845 6.14102 51.4425 6.42863 51.4425 6.73527 51.4429 7.04192 51.3845 7.33195 51.2703 7.60052z" fill="#fff"/><path d="M63.628 6.08918 66.2472 4.34856C66.4141 4.23352 66.4955 4.05731 66.4963 3.82034 66.4959 3.73163 66.4777 3.64737 66.4428 3.56798 66.408 3.48777 66.3614 3.41486 66.3031 3.35328 66.2448 3.29212 66.1751 3.24229 66.0957 3.20948 66.0167 3.17667 65.9304 3.15763 65.8397 3.15763 65.7092 3.15763 65.593 3.19085 65.4905 3.2589L61.7516 5.74689V.75674C61.7516.567974 61.6889.409993 61.5609.280369 61.4329.150744 61.2814.0847168 61.1023.0847168 60.9233.0847168 60.7649.150744 60.6365.280369 60.5085.409993 60.4457.567974 60.4457.75674V9.64778C60.4457 9.83168 60.5085 9.98966 60.6365 10.1217 60.7645 10.2538 60.9184 10.3198 61.1023 10.3198S61.4353 10.2538 61.5609 10.1217C61.6889 9.98966 61.7516 9.83168 61.7516 9.64778V7.33884L62.5152 6.82723l2.8894 3.31797C65.5209 10.2607 65.6675 10.3174 65.8421 10.3174 65.9329 10.3174 66.0191 10.3008 66.0981 10.2655 66.1771 10.2323 66.2472 10.1829 66.3055 10.1217 66.3639 10.0606 66.4104 9.98966 66.4453 9.90703 66.4801 9.82682 66.4987 9.73973 66.4987 9.65223 66.4987 9.47764 66.4384 9.3221 66.3173 9.18518l-2.6893-3.096z" fill="#fff"/><path d="M56.9841 10.3247C57.8595 10.3247 58.621 10.0346 59.2659 9.45457 59.4032 9.31319 59.4733 9.15035 59.4733 8.96159 59.4733 8.77282 59.4126 8.60998 59.2894 8.48522 59.1659 8.36005 59.0099 8.29645 58.824 8.29645 58.6656 8.30131 58.5283 8.3483 58.412 8.43782 58.2026 8.62173 57.9838 8.75864 57.7485 8.8506 57.5156 8.94255 57.262 8.98751 56.9849 8.98751 56.6799 8.98751 56.3959 8.92837 56.1282 8.81049 55.8604 8.69262 55.6275 8.53221 55.4274 8.33169 55.2273 8.13118 55.0689 7.89056 54.9547 7.61957 54.8404 7.34614 54.7825 7.05368 54.7825 6.74217 54.7825 6.43067 54.8409 6.1386 54.9547 5.86477 55.0689 5.59135 55.2269 5.35519 55.4274 5.15265V5.15022C55.6275 4.94727 55.8604 4.78686 56.1282 4.67142 56.3959 4.55354 56.6799 4.4944 56.9849 4.4944 57.2596 4.4944 57.5136 4.54139 57.7485 4.63577 57.9814 4.73015 58.205 4.86909 58.4165 5.05097 58.542 5.15224 58.6842 5.20409 58.8426 5.20409 59.0314 5.20409 59.1849 5.1405 59.3084 5.0133 59.432 4.88611 59.4924 4.7257 59.4924 4.5345 59.4924 4.34371 59.4178 4.16669 59.2663 4.02977 58.6239 3.4497 57.8623 3.15967 56.9845 3.15967c-.966099999999997.0-1.7929.34917-2.477 1.04955C53.8229 4.90717 53.483 5.75135 53.483 6.74217 53.483 7.73258 53.8253 8.57474 54.5075 9.27512 55.1912 9.97306 56.0156 10.3247 56.9841 10.3247z" fill="#fff"/><path d="M44.774 32.4167C43.578 32.4167 42.497 32.1407 41.531 31.5887 40.5803 31.0214 39.8213 30.2547 39.254 29.2887 38.702 28.3227 38.426 27.234 38.426 26.0227s.253-2.2923.759-3.243C39.7063 21.8137 40.4117 21.0547 41.301 20.5027 42.1903 19.9354 43.1947 19.6517 44.314 19.6517 45.2187 19.6517 46.0543 19.8434 46.821 20.2267 47.5877 20.5947 48.2317 21.1007 48.753 21.7447v-6.21C48.753 15.182 48.8603 14.8984 49.075 14.6837 49.305 14.469 49.5887 14.3617 49.926 14.3617 50.2787 14.3617 50.5623 14.469 50.777 14.6837S51.099 15.182 51.099 15.5347v10.488C51.099 27.234 50.8153 28.3227 50.248 29.2887 49.696 30.2547 48.9447 31.0214 47.994 31.5887 47.0433 32.1407 45.97 32.4167 44.774 32.4167zm0-2.07C45.556 30.3467 46.2537 30.1627 46.867 29.7947 47.4803 29.4114 47.9633 28.89 48.316 28.2307 48.6687 27.5714 48.845 26.8354 48.845 26.0227 48.845 25.1947 48.6687 24.4587 48.316 23.8147 47.9633 23.1707 47.4803 22.6647 46.867 22.2967 46.2537 21.9134 45.556 21.7217 44.774 21.7217 44.0073 21.7217 43.3097 21.9134 42.681 22.2967 42.0677 22.6647 41.577 23.1707 41.209 23.8147 40.8563 24.4587 40.68 25.1947 40.68 26.0227 40.68 26.8354 40.8563 27.5714 41.209 28.2307 41.577 28.89 42.0677 29.4114 42.681 29.7947 43.3097 30.1627 44.0073 30.3467 44.774 30.3467zm15.1719 2.07c-1.242.0-2.3384-.268299999999996-3.289-.805-.950699999999998-.552-1.702-1.3033-2.254-2.254C53.8662 28.3917 53.5979 27.2877 53.5979 26.0457c0-1.2573.268299999999996-2.3613.805-3.312.552-.965999999999998 1.3033-1.7173 2.254-2.254C57.6075 19.9277 58.7039 19.6517 59.9459 19.6517c1.2266.0 2.3153.276 3.266.827999999999999C64.1625 21.0164 64.9062 21.7677 65.4429 22.7337 65.9949 23.6844 66.2709 24.7884 66.2709 26.0457c0 1.242-.2684 2.346-.804999999999993 3.312C64.9292 30.3084 64.1855 31.0597 63.2349 31.6117 62.2842 32.1484 61.1879 32.4167 59.9459 32.4167zm0-2.07c.7973.0 1.5026-.183999999999998 2.116-.552C62.6752 29.4267 63.1505 28.9207 63.4879 28.2767 63.8405 27.6327 64.0169 26.889 64.0169 26.0457S63.8405 24.4587 63.4879 23.8147C63.1505 23.1554 62.6752 22.6417 62.0619 22.2737 61.4485 21.9057 60.7432 21.7217 59.9459 21.7217 59.1485 21.7217 58.4432 21.9057 57.8299 22.2737 57.2165 22.6417 56.7335 23.1554 56.3809 23.8147 56.0282 24.4587 55.8519 25.2024 55.8519 26.0457S56.0282 27.6327 56.3809 28.2767C56.7335 28.9207 57.2165 29.4267 57.8299 29.7947 58.4432 30.1627 59.1485 30.3467 59.9459 30.3467zm14.5205 2.07C73.2397 32.4167 72.1434 32.1407 71.1774 31.5887 70.2267 31.0214 69.4754 30.2624 68.9234 29.3117 68.3867 28.3457 68.1184 27.257 68.1184 26.0457 68.1184 24.8037 68.3867 23.6997 68.9234 22.7337 69.46 21.7677 70.196 21.0164 71.1314 20.4797 72.0667 19.9277 73.14 19.6517 74.3514 19.6517 75.256 19.6517 76.084 19.828 76.8354 20.1807 77.5867 20.518 78.2614 21.0317 78.8594 21.7217 79.0741 21.967 79.1507 22.22 79.0894 22.4807S78.8594 22.9714 78.5834 23.1707C78.3687 23.324 78.1311 23.3777 77.8704 23.3317 77.6097 23.2704 77.372 23.1324 77.1574 22.9177 76.406 22.1204 75.4707 21.7217 74.3514 21.7217 73.5694 21.7217 72.8794 21.9057 72.2814 22.2737 71.6834 22.6264 71.2157 23.1247 70.8784 23.7687 70.541 24.4127 70.3724 25.1717 70.3724 26.0457 70.3724 26.8737 70.541 27.6097 70.8784 28.2537 71.231 28.8977 71.714 29.4114 72.3274 29.7947 72.9407 30.1627 73.6537 30.3467 74.4664 30.3467 75.0031 30.3467 75.4707 30.2854 75.8694 30.1627 76.2834 30.0247 76.6591 29.8177 76.9964 29.5417 77.2417 29.3424 77.4947 29.235 77.7554 29.2197 78.0161 29.189 78.2461 29.258 78.4454 29.4267 78.706 29.6414 78.8517 29.8867 78.8824 30.1627 78.913 30.4234 78.821 30.661 78.6064 30.8757 77.5024 31.903 76.1224 32.4167 74.4664 32.4167zm11.6865.0C85.0795 32.4167 84.0829 32.2557 83.1629 31.9337 82.2582 31.5964 81.5529 31.1747 81.0469 30.6687 80.8169 30.4234 80.7172 30.1474 80.7479 29.8407 80.7939 29.5187 80.9472 29.258 81.2079 29.0587 81.5145 28.8134 81.8135 28.7137 82.1049 28.7597 82.4115 28.7904 82.6722 28.9207 82.8869 29.1507 83.1475 29.442 83.5615 29.718 84.1289 29.9787 84.7115 30.224 85.3555 30.3467 86.0609 30.3467 86.9502 30.3467 87.6249 30.201 88.0849 29.9097 88.5602 29.6184 88.8055 29.2427 88.8209 28.7827 88.8362 28.3227 88.6139 27.924 88.1539 27.5867 87.7092 27.2494 86.8889 26.9734 85.6929 26.7587 84.1442 26.452 83.0172 25.992 82.3119 25.3787 81.6219 24.7654 81.2769 24.014 81.2769 23.1247 81.2769 22.3427 81.5069 21.6987 81.9669 21.1927 82.4269 20.6714 83.0172 20.288 83.7379 20.0427 84.4585 19.782 85.2099 19.6517 85.9919 19.6517 87.0039 19.6517 87.9009 19.8127 88.6829 20.1347 89.4649 20.4567 90.0859 20.9014 90.5459 21.4687 90.7605 21.714 90.8602 21.9747 90.8449 22.2507 90.8295 22.5114 90.6992 22.7337 90.4539 22.9177 90.2085 23.0864 89.9172 23.14 89.5799 23.0787 89.2425 23.0174 88.9589 22.8794 88.7289 22.6647 88.3455 22.2967 87.9315 22.0437 87.4869 21.9057 87.0422 21.7677 86.5285 21.6987 85.9459 21.6987 85.2712 21.6987 84.6962 21.8137 84.2209 22.0437 83.7609 22.2737 83.5309 22.611 83.5309 23.0557 83.5309 23.3317 83.5999 23.5847 83.7379 23.8147 83.8912 24.0294 84.1825 24.2287 84.6119 24.4127 85.0412 24.5814 85.6699 24.75 86.4979 24.9187 87.6479 25.1487 88.5525 25.44 89.2119 25.7927 89.8865 26.1454 90.3695 26.5594 90.6609 27.0347 90.9522 27.4947 91.0979 28.0314 91.0979 28.6447 91.0979 29.35 90.9062 29.9864 90.5229 30.5537 90.1549 31.121 89.6029 31.5734 88.8669 31.9107 88.1462 32.248 87.2415 32.4167 86.1529 32.4167z" fill="#fff"/></svg></div></a></div><div><nav><ul class="box-content flex mt-1 gap-4 md:hidden"><li><a class="block py-1 px-2" href="../../../get-started/overview/index.html">Guides</a></li><li><a class="block py-1 px-2" href="../../../manuals/index.html">Manuals</a></li><li class=border-b-4><a class="block py-1 px-2" href="../../../app/working-with-app/index.html">Reference</a></li><li><a class="block py-1 px-2" href="../../../samples/index.html">Samples</a></li><li><a class="block py-1 px-2" href="../../../faq/index.html">FAQ</a></li></ul></nav></div></div><div class="flex items-center gap-6"><div id=docsearch></div><button aria-label="Theme switch" id=theme-switch class=svg-icon x-data="{ theme: localStorage.getItem('theme-preference') }" x-init="$watch('theme', value => {
        localStorage.setItem('theme-preference', value);
        document.firstElementChild.className = value;
      })" @click="theme = (theme === 'dark' ? 'light' : 'dark')">
<span class="icon-svg dark:hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-280q-83 0-141.5-58.5T280-480t58.5-141.5T480-680t141.5 58.5T680-480t-58.5 141.5T480-280zM70-450q-12.75.0-21.375-8.675Q40-467.351 40-480.175 40-493 48.625-501.5T70-510h1e2q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T170-450H70zm720 0q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T790-510h1e2q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T890-450H790zM479.825-760Q467-760 458.5-768.625T450-790v-1e2q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T510-890v1e2q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625zm0 720Q467-40 458.5-48.625T450-70v-1e2q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T510-170v1e2q0 12.75-8.675 21.375Q492.649-40 479.825-40zM240-678l-57-56q-9-9-8.629-21.603.37-12.604 8.526-21.5 8.896-8.897 21.5-8.897Q217-786 226-777l56 57q8 9 8 21t-8 20.5-20.5 8.5-21.5-8zm494 495-56-57q-8-9-8-21.375T678.5-282q8.5-9 20.5-9t21 9l57 56q9 9 8.629 21.603-.37 12.604-8.526 21.5-8.896 8.897-21.5 8.897Q743-174 734-183zm-56-495q-9-9-9-21t9-21l56-57q9-9 21.603-8.629 12.604.37 21.5 8.526 8.897 8.896 8.897 21.5Q786-743 777-734l-57 56q-8 8-20.364 8-12.363.0-21.636-8zM182.897-182.897q-8.897-8.896-8.897-21.5Q174-217 183-226l57-56q8.8-9 20.9-9 12.1.0 20.709 9Q291-273 291-261t-9 21l-56 57q-9 9-21.603 8.629-12.604-.37-21.5-8.526z"/></svg></span>
<span class="icon-svg hidden dark:block"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-120q-150 0-255-105T120-480q0-135 79.5-229T408-830q20-5 34-1t22 15q8 10 7.5 25t-8.5 35q-9 23-14 47t-5 49q0 90 63 153t153 63q25 0 48.5-4.5T754-461t38-7 26 9 13 23-2 36q-27 121-121 200.5T480-120z"/></svg></span></button></div></div></header><main class=flex><div id=sidebar class="sticky top-16 flex h-screen shrink-0 grow flex-row-reverse overflow-y-scroll bg-background-light dark:bg-gray-dark-100 md:fixed md:z-10 md:hidden md:h-screen md:w-screen lg:grow-0"><nav class="text-sm py-4 hidden gap-4 pl-4 md:flex flex-col justify-evenly"><div class="text-gray-light dark:text-gray-dark">Main sections</div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../get-started/overview/index.html">Guides</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../manuals/index.html">Manuals</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75
underline"><a href="../../../app/working-with-app/index.html">Reference</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../samples/index.html">Samples</a></div><div class="pl-2 underline-offset-8 decoration-2 hover:underline decoration-blue-light dark:decoration-blue-dark hover:opacity-75"><a href="../../../faq/index.html">FAQ</a></div></nav><hr><nav id=sectiontree class="text-sm w-[300px] md:w-full flex flex-col"><div class="hidden md:block p-4 text-gray-light dark:text-gray-dark">This section</div><ul><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../app/working-with-app/index.html" title="Reference documentation"><span class="flex items-center gap-2">Reference documentation</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">CLI reference
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/index.html" title="docker (base command)"><span class="flex items-center gap-2">docker (base command)</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/build/index.html" title="docker build"><span class="flex items-center gap-2">docker build</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker builder
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/builder/index.html" title="docker builder"><span class="flex items-center gap-2">docker builder</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/builder/build/index.html" title="docker builder build"><span class="flex items-center gap-2">docker builder build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/builder/prune/index.html" title="docker builder prune"><span class="flex items-center gap-2">docker builder prune</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker buildx
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/index.html" title="docker buildx"><span class="flex items-center gap-2">docker buildx</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/bake/index.html" title="docker buildx bake"><span class="flex items-center gap-2">docker buildx bake</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/reference/commandline/buildx_build/index.html" title="docker buildx build"><span class="flex items-center gap-2">docker buildx build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/create/index.html" title="docker buildx create"><span class="flex items-center gap-2">docker buildx create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/debug/index.html" title="docker buildx debug"><span class="flex items-center gap-2">docker buildx debug</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/debug/build/index.html" title="docker buildx debug build"><span class="flex items-center gap-2">docker buildx debug build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/du/index.html" title="docker buildx du"><span class="flex items-center gap-2">docker buildx du</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/imagetools/index.html" title="docker buildx imagetools"><span class="flex items-center gap-2">docker buildx imagetools</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/imagetools/create/index.html" title="docker buildx imagetools create"><span class="flex items-center gap-2">docker buildx imagetools create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/imagetools/inspect/index.html" title="docker buildx imagetools inspect"><span class="flex items-center gap-2">docker buildx imagetools inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/inspect/index.html" title="docker buildx inspect"><span class="flex items-center gap-2">docker buildx inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/ls/index.html" title="docker buildx ls"><span class="flex items-center gap-2">docker buildx ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/prune/index.html" title="docker buildx prune"><span class="flex items-center gap-2">docker buildx prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/rm/index.html" title="docker buildx rm"><span class="flex items-center gap-2">docker buildx rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/stop/index.html" title="docker buildx stop"><span class="flex items-center gap-2">docker buildx stop</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/use/index.html" title="docker buildx use"><span class="flex items-center gap-2">docker buildx use</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/buildx/version/index.html" title="docker buildx version"><span class="flex items-center gap-2">docker buildx version</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker checkpoint
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/checkpoint/index.html" title="docker checkpoint"><span class="flex items-center gap-2">docker checkpoint</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/checkpoint/create/index.html" title="docker checkpoint create"><span class="flex items-center gap-2">docker checkpoint create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/checkpoint/ls/index.html" title="docker checkpoint ls"><span class="flex items-center gap-2">docker checkpoint ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/checkpoint/rm/index.html" title="docker checkpoint rm"><span class="flex items-center gap-2">docker checkpoint rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker compose
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../reference/index.html" title=overview><span class="flex items-center gap-2">overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/alpha/index.html" title="docker compose alpha"><span class="flex items-center gap-2">docker compose alpha</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/alpha/dry-run/index.html" title="docker compose alpha dry-run"><span class="flex items-center gap-2">docker compose alpha dry-run</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/alpha/publish/index.html" title="docker compose alpha publish"><span class="flex items-center gap-2">docker compose alpha publish</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/alpha/scale/index.html" title="docker compose alpha scale"><span class="flex items-center gap-2">docker compose alpha scale</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/alpha/viz/index.html" title="docker compose alpha viz"><span class="flex items-center gap-2">docker compose alpha viz</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/index.html" title="docker compose"><span class="flex items-center gap-2">docker compose</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/build/index.html" title="docker compose build"><span class="flex items-center gap-2">docker compose build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/config/index.html" title="docker compose config"><span class="flex items-center gap-2">docker compose config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/cp/index.html" title="docker compose cp"><span class="flex items-center gap-2">docker compose cp</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/create/index.html" title="docker compose create"><span class="flex items-center gap-2">docker compose create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/down/index.html" title="docker compose down"><span class="flex items-center gap-2">docker compose down</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/events/index.html" title="docker compose events"><span class="flex items-center gap-2">docker compose events</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/exec/index.html" title="docker compose exec"><span class="flex items-center gap-2">docker compose exec</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/images/index.html" title="docker compose images"><span class="flex items-center gap-2">docker compose images</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/kill/index.html" title="docker compose kill"><span class="flex items-center gap-2">docker compose kill</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/logs/index.html" title="docker compose logs"><span class="flex items-center gap-2">docker compose logs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/ls/index.html" title="docker compose ls"><span class="flex items-center gap-2">docker compose ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/pause/index.html" title="docker compose pause"><span class="flex items-center gap-2">docker compose pause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/port/index.html" title="docker compose port"><span class="flex items-center gap-2">docker compose port</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/ps/index.html" title="docker compose ps"><span class="flex items-center gap-2">docker compose ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/pull/index.html" title="docker compose pull"><span class="flex items-center gap-2">docker compose pull</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/push/index.html" title="docker compose push"><span class="flex items-center gap-2">docker compose push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/restart/index.html" title="docker compose restart"><span class="flex items-center gap-2">docker compose restart</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/rm/index.html" title="docker compose rm"><span class="flex items-center gap-2">docker compose rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/run/index.html" title="docker compose run"><span class="flex items-center gap-2">docker compose run</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/start/index.html" title="docker compose start"><span class="flex items-center gap-2">docker compose start</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/stop/index.html" title="docker compose stop"><span class="flex items-center gap-2">docker compose stop</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/top/index.html" title="docker compose top"><span class="flex items-center gap-2">docker compose top</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/unpause/index.html" title="docker compose unpause"><span class="flex items-center gap-2">docker compose unpause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/up/index.html" title="docker compose up"><span class="flex items-center gap-2">docker compose up</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/version/index.html" title="docker compose version"><span class="flex items-center gap-2">docker compose version</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/wait/index.html" title="docker compose wait"><span class="flex items-center gap-2">docker compose wait</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/compose/watch/index.html" title="docker compose watch"><span class="flex items-center gap-2">docker compose watch</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker config
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/config/index.html" title="docker config"><span class="flex items-center gap-2">docker config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/config/create/index.html" title="docker config create"><span class="flex items-center gap-2">docker config create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/config/inspect/index.html" title="docker config inspect"><span class="flex items-center gap-2">docker config inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/config/ls/index.html" title="docker config ls"><span class="flex items-center gap-2">docker config ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/config/rm/index.html" title="docker config rm"><span class="flex items-center gap-2">docker config rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker container
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/index.html" title="docker container"><span class="flex items-center gap-2">docker container</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/attach/index.html" title="docker container attach"><span class="flex items-center gap-2">docker container attach</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/commit/index.html" title="docker container commit"><span class="flex items-center gap-2">docker container commit</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/cp/index.html" title="docker container cp"><span class="flex items-center gap-2">docker container cp</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/create/index.html" title="docker container create"><span class="flex items-center gap-2">docker container create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/diff/index.html" title="docker container diff"><span class="flex items-center gap-2">docker container diff</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/exec/index.html" title="docker container exec"><span class="flex items-center gap-2">docker container exec</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/export/index.html" title="docker container export"><span class="flex items-center gap-2">docker container export</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/inspect/index.html" title="docker container inspect"><span class="flex items-center gap-2">docker container inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/kill/index.html" title="docker container kill"><span class="flex items-center gap-2">docker container kill</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/logs/index.html" title="docker container logs"><span class="flex items-center gap-2">docker container logs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/ps/index.html" title="docker container ls"><span class="flex items-center gap-2">docker container ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/pause/index.html" title="docker container pause"><span class="flex items-center gap-2">docker container pause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/port/index.html" title="docker container port"><span class="flex items-center gap-2">docker container port</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/prune/index.html" title="docker container prune"><span class="flex items-center gap-2">docker container prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/rename/index.html" title="docker container rename"><span class="flex items-center gap-2">docker container rename</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/restart/index.html" title="docker container restart"><span class="flex items-center gap-2">docker container restart</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/rm/index.html" title="docker container rm"><span class="flex items-center gap-2">docker container rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/reference/commandline/run/index.html" title="docker container run"><span class="flex items-center gap-2">docker container run</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/start/index.html" title="docker container start"><span class="flex items-center gap-2">docker container start</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/stats/index.html" title="docker container stats"><span class="flex items-center gap-2">docker container stats</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/stop/index.html" title="docker container stop"><span class="flex items-center gap-2">docker container stop</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/top/index.html" title="docker container top"><span class="flex items-center gap-2">docker container top</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/unpause/index.html" title="docker container unpause"><span class="flex items-center gap-2">docker container unpause</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/update/index.html" title="docker container update"><span class="flex items-center gap-2">docker container update</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/container/wait/index.html" title="docker container wait"><span class="flex items-center gap-2">docker container wait</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker context
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/index.html" title="docker context"><span class="flex items-center gap-2">docker context</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/create/index.html" title="docker context create"><span class="flex items-center gap-2">docker context create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/export/index.html" title="docker context export"><span class="flex items-center gap-2">docker context export</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/import/index.html" title="docker context import"><span class="flex items-center gap-2">docker context import</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/inspect/index.html" title="docker context inspect"><span class="flex items-center gap-2">docker context inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/ls/index.html" title="docker context ls"><span class="flex items-center gap-2">docker context ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/rm/index.html" title="docker context rm"><span class="flex items-center gap-2">docker context rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/show/index.html" title="docker context show"><span class="flex items-center gap-2">docker context show</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/update/index.html" title="docker context update"><span class="flex items-center gap-2">docker context update</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/context/use/index.html" title="docker context use"><span class="flex items-center gap-2">docker context use</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/debug/index.html" title="docker debug (Beta)"><span class="flex items-center gap-2">docker debug (Beta)</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/exec/index.html" title="docker exec"><span class="flex items-center gap-2">docker exec</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker image
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/index.html" title="docker image"><span class="flex items-center gap-2">docker image</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/builder/build/index.html" title="docker image build"><span class="flex items-center gap-2">docker image build</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/history/index.html" title="docker image history"><span class="flex items-center gap-2">docker image history</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/import/index.html" title="docker image import"><span class="flex items-center gap-2">docker image import</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/inspect/index.html" title="docker image inspect"><span class="flex items-center gap-2">docker image inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/load/index.html" title="docker image load"><span class="flex items-center gap-2">docker image load</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/images/index.html" title="docker image ls"><span class="flex items-center gap-2">docker image ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/prune/index.html" title="docker image prune"><span class="flex items-center gap-2">docker image prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/pull/index.html" title="docker image pull"><span class="flex items-center gap-2">docker image pull</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/push/index.html" title="docker image push"><span class="flex items-center gap-2">docker image push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/rm/index.html" title="docker image rm"><span class="flex items-center gap-2">docker image rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/save/index.html" title="docker image save"><span class="flex items-center gap-2">docker image save</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/image/tag/index.html" title="docker image tag"><span class="flex items-center gap-2">docker image tag</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/images/index.html" title="docker images"><span class="flex items-center gap-2">docker images</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/info/index.html" title="docker info"><span class="flex items-center gap-2">docker info</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/init/index.html" title="docker init"><span class="flex items-center gap-2">docker init</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/inspect/index.html" title="docker inspect"><span class="flex items-center gap-2">docker inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/login/index.html" title="docker login"><span class="flex items-center gap-2">docker login</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/logout/index.html" title="docker logout"><span class="flex items-center gap-2">docker logout</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker manifest
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/manifest/index.html" title="docker manifest"><span class="flex items-center gap-2">docker manifest</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/manifest/annotate/index.html" title="docker manifest annotate"><span class="flex items-center gap-2">docker manifest annotate</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/manifest/create/index.html" title="docker manifest create"><span class="flex items-center gap-2">docker manifest create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/manifest/inspect/index.html" title="docker manifest inspect"><span class="flex items-center gap-2">docker manifest inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/manifest/push/index.html" title="docker manifest push"><span class="flex items-center gap-2">docker manifest push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/manifest/rm/index.html" title="docker manifest rm"><span class="flex items-center gap-2">docker manifest rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker network
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/index.html" title="docker network"><span class="flex items-center gap-2">docker network</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/connect/index.html" title="docker network connect"><span class="flex items-center gap-2">docker network connect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/create/index.html" title="docker network create"><span class="flex items-center gap-2">docker network create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/disconnect/index.html" title="docker network disconnect"><span class="flex items-center gap-2">docker network disconnect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/inspect/index.html" title="docker network inspect"><span class="flex items-center gap-2">docker network inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/ls/index.html" title="docker network ls"><span class="flex items-center gap-2">docker network ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/prune/index.html" title="docker network prune"><span class="flex items-center gap-2">docker network prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/network/rm/index.html" title="docker network rm"><span class="flex items-center gap-2">docker network rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker node
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/index.html" title="docker node"><span class="flex items-center gap-2">docker node</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/demote/index.html" title="docker node demote"><span class="flex items-center gap-2">docker node demote</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/inspect/index.html" title="docker node inspect"><span class="flex items-center gap-2">docker node inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/ls/index.html" title="docker node ls"><span class="flex items-center gap-2">docker node ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/promote/index.html" title="docker node promote"><span class="flex items-center gap-2">docker node promote</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/ps/index.html" title="docker node ps"><span class="flex items-center gap-2">docker node ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/rm/index.html" title="docker node rm"><span class="flex items-center gap-2">docker node rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/node/update/index.html" title="docker node update"><span class="flex items-center gap-2">docker node update</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker plugin
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/index.html" title="docker plugin"><span class="flex items-center gap-2">docker plugin</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/create/index.html" title="docker plugin create"><span class="flex items-center gap-2">docker plugin create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/disable/index.html" title="docker plugin disable"><span class="flex items-center gap-2">docker plugin disable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/enable/index.html" title="docker plugin enable"><span class="flex items-center gap-2">docker plugin enable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/inspect/index.html" title="docker plugin inspect"><span class="flex items-center gap-2">docker plugin inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/install/index.html" title="docker plugin install"><span class="flex items-center gap-2">docker plugin install</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/ls/index.html" title="docker plugin ls"><span class="flex items-center gap-2">docker plugin ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/rm/index.html" title="docker plugin rm"><span class="flex items-center gap-2">docker plugin rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/set/index.html" title="docker plugin set"><span class="flex items-center gap-2">docker plugin set</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/plugin/upgrade/index.html" title="docker plugin upgrade"><span class="flex items-center gap-2">docker plugin upgrade</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/ps/index.html" title="docker ps"><span class="flex items-center gap-2">docker ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/pull/index.html" title="docker pull"><span class="flex items-center gap-2">docker pull</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/push/index.html" title="docker push"><span class="flex items-center gap-2">docker push</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/run/index.html" title="docker run"><span class="flex items-center gap-2">docker run</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker scout
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/index.html" title="docker scout"><span class="flex items-center gap-2">docker scout</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/attestation/index.html" title="docker scout attestation"><span class="flex items-center gap-2">docker scout attestation</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/attestation/add/index.html" title="docker scout attestation add"><span class="flex items-center gap-2">docker scout attestation add</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/cache/index.html" title="docker scout cache"><span class="flex items-center gap-2">docker scout cache</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/cache/df/index.html" title="docker scout cache df"><span class="flex items-center gap-2">docker scout cache df</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/cache/prune/index.html" title="docker scout cache prune"><span class="flex items-center gap-2">docker scout cache prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/compare/index.html" title="docker scout compare"><span class="flex items-center gap-2">docker scout compare</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/config/index.html" title="docker scout config"><span class="flex items-center gap-2">docker scout config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/cves.html" title="docker scout cves"><span class="flex items-center gap-2">docker scout cves</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/enroll/index.html" title="docker scout enroll"><span class="flex items-center gap-2">docker scout enroll</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/environment/index.html" title="docker scout environment"><span class="flex items-center gap-2">docker scout environment</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/integration/index.html" title="docker scout integration"><span class="flex items-center gap-2">docker scout integration</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/integration/configure/index.html" title="docker scout integration configure"><span class="flex items-center gap-2">docker scout integration configure</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/integration/delete/index.html" title="docker scout integration delete"><span class="flex items-center gap-2">docker scout integration delete</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/integration/list/index.html" title="docker scout integration list"><span class="flex items-center gap-2">docker scout integration list</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/policy/index.html" title="docker scout policy"><span class="flex items-center gap-2">docker scout policy</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/quickview/index.html" title="docker scout quickview"><span class="flex items-center gap-2">docker scout quickview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/recommendations/index.html" title="docker scout recommendations"><span class="flex items-center gap-2">docker scout recommendations</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/repo/index.html" title="docker scout repo"><span class="flex items-center gap-2">docker scout repo</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/repo/disable/index.html" title="docker scout repo disable"><span class="flex items-center gap-2">docker scout repo disable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/repo/enable.html" title="docker scout repo enable"><span class="flex items-center gap-2">docker scout repo enable</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/repo/list/index.html" title="docker scout repo list"><span class="flex items-center gap-2">docker scout repo list</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/sbom/index.html" title="docker scout sbom"><span class="flex items-center gap-2">docker scout sbom</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/stream/index.html" title="docker scout stream"><span class="flex items-center gap-2">docker scout stream</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/version/index.html" title="docker scout version"><span class="flex items-center gap-2">docker scout version</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/scout/watch/index.html" title="docker scout watch"><span class="flex items-center gap-2">docker scout watch</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/search/index.html" title="docker search"><span class="flex items-center gap-2">docker search</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker secret
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/secret/index.html" title="docker secret"><span class="flex items-center gap-2">docker secret</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/secret/create/index.html" title="docker secret create"><span class="flex items-center gap-2">docker secret create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/secret/inspect/index.html" title="docker secret inspect"><span class="flex items-center gap-2">docker secret inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/secret/ls/index.html" title="docker secret ls"><span class="flex items-center gap-2">docker secret ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/secret/rm/index.html" title="docker secret rm"><span class="flex items-center gap-2">docker secret rm</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker service
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/index.html" title="docker service"><span class="flex items-center gap-2">docker service</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/create/index.html" title="docker service create"><span class="flex items-center gap-2">docker service create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/inspect/index.html" title="docker service inspect"><span class="flex items-center gap-2">docker service inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/logs/index.html" title="docker service logs"><span class="flex items-center gap-2">docker service logs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/ls/index.html" title="docker service ls"><span class="flex items-center gap-2">docker service ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/ps/index.html" title="docker service ps"><span class="flex items-center gap-2">docker service ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/rollback/index.html" title="docker service rollback"><span class="flex items-center gap-2">docker service rollback</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/rm/index.html" title="docker service rm"><span class="flex items-center gap-2">docker service rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/scale/index.html" title="docker service scale"><span class="flex items-center gap-2">docker service scale</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/service/update/index.html" title="docker service update"><span class="flex items-center gap-2">docker service update</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker stack
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/index.html" title="docker stack"><span class="flex items-center gap-2">docker stack</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/config/index.html" title="docker stack config"><span class="flex items-center gap-2">docker stack config</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/deploy/index.html" title="docker stack deploy"><span class="flex items-center gap-2">docker stack deploy</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/ls/index.html" title="docker stack ls"><span class="flex items-center gap-2">docker stack ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/ps/index.html" title="docker stack ps"><span class="flex items-center gap-2">docker stack ps</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/rm/index.html" title="docker stack rm"><span class="flex items-center gap-2">docker stack rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/stack/services/index.html" title="docker stack services"><span class="flex items-center gap-2">docker stack services</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker swarm
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/index.html" title="docker swarm"><span class="flex items-center gap-2">docker swarm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/ca/index.html" title="docker swarm ca"><span class="flex items-center gap-2">docker swarm ca</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/init/index.html" title="docker swarm init"><span class="flex items-center gap-2">docker swarm init</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/join-token/index.html" title="docker swarm join-token"><span class="flex items-center gap-2">docker swarm join-token</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/join/index.html" title="docker swarm join"><span class="flex items-center gap-2">docker swarm join</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/leave/index.html" title="docker swarm leave"><span class="flex items-center gap-2">docker swarm leave</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/unlock-key/index.html" title="docker swarm unlock-key"><span class="flex items-center gap-2">docker swarm unlock-key</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/unlock/index.html" title="docker swarm unlock"><span class="flex items-center gap-2">docker swarm unlock</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/swarm/update/index.html" title="docker swarm update"><span class="flex items-center gap-2">docker swarm update</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker system
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/system/index.html" title="docker system"><span class="flex items-center gap-2">docker system</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/system/df/index.html" title="docker system df"><span class="flex items-center gap-2">docker system df</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/system/events/index.html" title="docker system events"><span class="flex items-center gap-2">docker system events</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/info/index.html" title="docker system info"><span class="flex items-center gap-2">docker system info</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/system/prune/index.html" title="docker system prune"><span class="flex items-center gap-2">docker system prune</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker trust
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/index.html" title="docker trust"><span class="flex items-center gap-2">docker trust</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/inspect/index.html" title="docker trust inspect"><span class="flex items-center gap-2">docker trust inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/key/index.html" title="docker trust key"><span class="flex items-center gap-2">docker trust key</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/key/generate/index.html" title="docker trust key generate"><span class="flex items-center gap-2">docker trust key generate</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/key/load/index.html" title="docker trust key load"><span class="flex items-center gap-2">docker trust key load</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/revoke/index.html" title="docker trust revoke"><span class="flex items-center gap-2">docker trust revoke</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/sign/index.html" title="docker trust sign"><span class="flex items-center gap-2">docker trust sign</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/signer/index.html" title="docker trust signer"><span class="flex items-center gap-2">docker trust signer</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/signer/add/index.html" title="docker trust signer add"><span class="flex items-center gap-2">docker trust signer add</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/trust/signer/remove/index.html" title="docker trust signer remove"><span class="flex items-center gap-2">docker trust signer remove</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/version/index.html" title="docker version"><span class="flex items-center gap-2">docker version</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">docker volume
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/volume/create/index.html" title="docker volume create"><span class="flex items-center gap-2">docker volume create</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/volume/inspect/index.html" title="docker volume inspect"><span class="flex items-center gap-2">docker volume inspect</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/volume/ls/index.html" title="docker volume ls"><span class="flex items-center gap-2">docker volume ls</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/volume/prune/index.html" title="docker volume prune"><span class="flex items-center gap-2">docker volume prune</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/volume/rm/index.html" title="docker volume rm"><span class="flex items-center gap-2">docker volume rm</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../reference/cli/docker/volume/update/index.html" title="docker volume update"><span class="flex items-center gap-2">docker volume update</span></a></li></ul></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/reference/builder/index.html" title="Dockerfile reference"><span class="flex items-center gap-2">Dockerfile reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/reference/commandline/dockerd/index.html" title="Daemon CLI (dockerd)"><span class="flex items-center gap-2">Daemon CLI (dockerd)</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">API reference
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Docker Engine API
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/index.html" title=Overview><span class="flex items-center gap-2">Overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/sdk/index.html" title=SDKs><span class="flex items-center gap-2">SDKs</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/sdk/examples/index.html" title="SDK examples"><span class="flex items-center gap-2">SDK examples</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/latest/index.html" title="v1.44 reference (latest)"><span class="flex items-center gap-2">v1.44 reference (latest)</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">API reference by version
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/version-history/index.html" title="Version history overview"><span class="flex items-center gap-2">Version history overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.42/index.html" title="v1.42 reference"><span class="flex items-center gap-2">v1.42 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.41/index.html" title="v1.41 reference"><span class="flex items-center gap-2">v1.41 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.40/index.html" title="v1.40 reference"><span class="flex items-center gap-2">v1.40 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.39/index.html" title="v1.39 reference"><span class="flex items-center gap-2">v1.39 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.38/index.html" title="v1.38 reference"><span class="flex items-center gap-2">v1.38 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.37/index.html" title="v1.37 reference"><span class="flex items-center gap-2">v1.37 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.36/index.html" title="v1.36 reference"><span class="flex items-center gap-2">v1.36 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.35/index.html" title="v1.35 reference"><span class="flex items-center gap-2">v1.35 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.34/index.html" title="v1.34 reference"><span class="flex items-center gap-2">v1.34 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.33/index.html" title="v1.33 reference"><span class="flex items-center gap-2">v1.33 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.32/index.html" title="v1.32 Reference"><span class="flex items-center gap-2">v1.32 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.31/index.html" title="v1.31 Reference"><span class="flex items-center gap-2">v1.31 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.30/index.html" title="v1.30 Reference"><span class="flex items-center gap-2">v1.30 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.29/index.html" title="v1.29 Reference"><span class="flex items-center gap-2">v1.29 Reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.28/index.html" title="v1.28 reference"><span class="flex items-center gap-2">v1.28 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.27/index.html" title="v1.27 reference"><span class="flex items-center gap-2">v1.27 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.26/index.html" title="v1.26 reference"><span class="flex items-center gap-2">v1.26 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.25/index.html" title="v1.25 reference"><span class="flex items-center gap-2">v1.25 reference</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../engine/api/v1.24/index.html" title="v1.24 reference"><span class="flex items-center gap-2">v1.24 reference</span></a></li></ul></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Docker Hub API
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../docker-hub/api/latest/index.html" title="Docker Hub API"><span class="flex items-center gap-2">Docker Hub API</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../docker-hub/api/dvp/index.html" title="DVP Data API"><span class="flex items-center gap-2">DVP Data API</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../docker-hub/api/deprecated/index.html" title="Deprecated API"><span class="flex items-center gap-2">Deprecated API</span></a></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Docker Extension SDK API
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/DesktopUI/index.html" title=DesktopUI><span class="flex items-center gap-2">DesktopUI</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/Dialog/index.html" title=Dialog><span class="flex items-center gap-2">Dialog</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/Docker/index.html" title=Docker><span class="flex items-center gap-2">Docker</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/DockerCommand/index.html" title=DockerCommand><span class="flex items-center gap-2">DockerCommand</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/DockerDesktopClient/index.html" title=DockerDesktopClient><span class="flex items-center gap-2">DockerDesktopClient</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/Exec/index.html" title=Exec><span class="flex items-center gap-2">Exec</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecProcess/index.html" title=ExecProcess><span class="flex items-center gap-2">ExecProcess</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecResult/index.html" title=ExecResult><span class="flex items-center gap-2">ExecResult</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecStreamOptions/index.html" title=ExecStreamOptions><span class="flex items-center gap-2">ExecStreamOptions</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/Extension/index.html" title=Extension><span class="flex items-center gap-2">Extension</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExtensionCli/index.html" title=ExtensionCli><span class="flex items-center gap-2">ExtensionCli</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExtensionHost/index.html" title=ExtensionHost><span class="flex items-center gap-2">ExtensionHost</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExtensionVM/index.html" title=ExtensionVM><span class="flex items-center gap-2">ExtensionVM</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/Host/index.html" title=Host><span class="flex items-center gap-2">Host</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/HttpService/index.html" title=HttpService><span class="flex items-center gap-2">HttpService</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/NavigationIntents/index.html" title=NavigationIntents><span class="flex items-center gap-2">NavigationIntents</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/OpenDialogResult/index.html" title=OpenDialogResult><span class="flex items-center gap-2">OpenDialogResult</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/RawExecResult/index.html" title=RawExecResult><span class="flex items-center gap-2">RawExecResult</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/RequestConfig/index.html" title=RequestConfig><span class="flex items-center gap-2">RequestConfig</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/RequestConfigV0/index.html" title=RequestConfigV0><span class="flex items-center gap-2">RequestConfigV0</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/Toast/index.html" title=Toast><span class="flex items-center gap-2">Toast</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/ExecResultV0/index.html" title=ExecResultV0><span class="flex items-center gap-2">ExecResultV0</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../desktop/extensions-sdk/dev/api/reference/interfaces/BackendV0/index.html" title=BackendV0><span class="flex items-center gap-2">BackendV0</span></a></li></ul></li></ul></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Compose file reference
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="ml-3 md:ml-[21px]"><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Compose Specification
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="hidden ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../compose-file.html" title=Overview><span class="flex items-center gap-2">Overview</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../04-version-and-name/index.html" title="Version and name top-level element"><span class="flex items-center gap-2">Version and name top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../05-services/index.html" title="Services top-level element"><span class="flex items-center gap-2">Services top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../06-networks/index.html" title="Network top-level element"><span class="flex items-center gap-2">Network top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../07-volumes/index.html" title="Volumes top-level element"><span class="flex items-center gap-2">Volumes top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../08-configs/index.html" title="Configs top-level element"><span class="flex items-center gap-2">Configs top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../09-secrets/index.html" title="Secrets top-level element"><span class="flex items-center gap-2">Secrets top-level element</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../10-fragments/index.html" title=Fragments><span class="flex items-center gap-2">Fragments</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../11-extension/index.html" title=Extensions><span class="flex items-center gap-2">Extensions</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../12-interpolation/index.html" title=Interpolation><span class="flex items-center gap-2">Interpolation</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../13-merge/index.html" title=Merge><span class="flex items-center gap-2">Merge</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../14-include/index.html" title=Include><span class="flex items-center gap-2">Include</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../15-profiles/index.html" title=Profiles><span class="flex items-center gap-2">Profiles</span></a></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../build/index.html" title="Compose Build Specification"><span class="flex items-center gap-2">Compose Build Specification</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../deploy/index.html" title="Compose Deploy Specification"><span class="flex items-center gap-2">Compose Deploy Specification</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../develop/index.html" title="Compose Develop Specification"><span class="flex items-center gap-2">Compose Develop Specification</span></a></li><li><button class="rounded px-4 sidebar-hover w-full flex items-center justify-between">
<span class="py-2 truncate flex items-center gap-2">Legacy versions
</span><span class="icon-svg hidden"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg>
</span><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span></button><ul class="ml-3 md:ml-[21px]"><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../compose-versioning/index.html" title="About versions and upgrading"><span class="flex items-center gap-2">About versions and upgrading</span></a></li><li class="pl-4 sidebar-hover rounded
bg-gray-light-200 dark:bg-gray-dark-200"><a aria-current=page class="py-2 w-full truncate block" href="index.html" title="Version 3"><span class="flex items-center gap-2">Version 3</span></a></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../compose-file-v2/index.html" title="Version 2"><span class="flex items-center gap-2">Version 2</span></a></li></ul></li></ul></li><li class="pl-4 sidebar-hover rounded"><a class="py-2 w-full truncate block" href="../../../glossary/index.html" title=Glossary><span class="flex items-center gap-2">Glossary</span></a></li></ul></nav></div><div class="w-[840px] flex-initial overflow-clip p-6 pt-0 md:w-lvw"><nav id=breadcrumbs class="py-4 gap-4 flex items-center text-gray-light dark:text-gray-dark max-w-full min-w-0"><a href="../../../app/working-with-app/index.html" class="link truncate">Reference</a><span>/</span><a "https://docs.docker.com/compose/compose-file/compose-file-v3/href" class="link truncate">Compose file reference</a><span>/</span><a href="../compose-versioning/index.html" class="link truncate">Legacy versions</a><span>/</span>
<span class=truncate>Version 3</span></nav><article class="DocSearch-content prose max-w-none dark:prose-invert"><h1 class=scroll-mt-36>Compose file version 3 reference</h1><blockquote class=important><p><strong>Important</strong></p><p>Docker's documentation refers to and describes Compose V2 functionality.</p><p>Effective July 2023, Compose V1 stopped receiving updates and is no longer in new Docker Desktop releases. Compose V2 has replaced it and is now integrated into all current Docker Desktop versions. For more information, see
<a class=link href="../../migrate.html">Migrate to Compose V2</a>.</p></blockquote><h2 class=scroll-mt-20 id=reference-and-guidelines><a class="text-black dark:text-white no-underline hover:underline" href="index.html#reference-and-guidelines">Reference and guidelines</a></h2><p>These topics describe version 3 of the Compose file format.</p><h2 class=scroll-mt-20 id=compose-and-docker-compatibility-matrix><a class="text-black dark:text-white no-underline hover:underline" href="index.html#compose-and-docker-compatibility-matrix">Compose and Docker compatibility matrix</a></h2><p>There are several versions of the Compose file format – 1, 2, 2.x, and 3.x. The
table below is a quick look. For full details on what each version includes and
how to upgrade, see <strong><a class=link href="../compose-versioning/index.html">About versions and upgrading</a></strong>.</p><p>This table shows which Compose file versions support specific Docker releases.</p><table><thead><tr><th><strong>Compose file format</strong></th><th><strong>Docker Engine release</strong></th></tr></thead><tbody><tr><td>Compose specification</td><td>19.03.0+</td></tr><tr><td>3.8</td><td>19.03.0+</td></tr><tr><td>3.7</td><td>18.06.0+</td></tr><tr><td>3.6</td><td>18.02.0+</td></tr><tr><td>3.5</td><td>17.12.0+</td></tr><tr><td>3.4</td><td>17.09.0+</td></tr><tr><td>3.3</td><td>17.06.0+</td></tr><tr><td>3.2</td><td>17.04.0+</td></tr><tr><td>3.1</td><td>1.13.1+</td></tr><tr><td>3.0</td><td>1.13.0+</td></tr><tr><td>2.4</td><td>17.12.0+</td></tr><tr><td>2.3</td><td>17.06.0+</td></tr><tr><td>2.2</td><td>1.13.0+</td></tr><tr><td>2.1</td><td>1.12.0+</td></tr><tr><td>2.0</td><td>1.10.0+</td></tr></tbody></table><p>In addition to Compose file format versions shown in the table, the Compose
itself is on a release schedule, as shown in
<a class=link href=https://github.com/docker/compose/releases/ target=_blank rel=noopener>Compose
releases<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>, but file format versions
do not necessarily increment with each release. For example, Compose file format
3.0 was first introduced in
<a class=link href=https://github.com/docker/compose/releases/tag/1.10.0 target=_blank rel=noopener>Compose release
1.10.0<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>, and versioned
gradually in subsequent releases.</p><p>The latest Compose file format is defined by the
<a class=link href=https://github.com/compose-spec/compose-spec/blob/master/spec.md target=_blank rel=noopener>Compose Specification<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a> and is implemented by Docker Compose <strong>1.27.0+</strong>.</p><h2 class=scroll-mt-20 id=compose-file-structure-and-examples><a class="text-black dark:text-white no-underline hover:underline" href="index.html#compose-file-structure-and-examples">Compose file structure and examples</a></h2><p>Here is a sample Compose file from the voting app sample used in the
<a class=link href=https://github.com/docker/labs/tree/master/beginner/ target=_blank rel=noopener>Docker for Beginners lab<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
topic on
<a class=link href=https://github.com/docker/labs/blob/master/beginner/chapters/votingapp.md target=_blank rel=noopener>Deploying an app to a Swarm<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>:</p><div x-data="{ open: false }" class="border border-gray-light-200 dark:border-gray-dark-200 bg-white dark:bg-gray-dark-100"><button class="not-prose w-full py-2 px-4 flex justify-between" x-on:click="open = ! open">
<span>Example Compose file version 3</span>
<span :class="{ 'hidden' : !open }" class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-543 304-367q-9 9-21.5 9.5T261-366t-9-21.5 9-21.5l198-198q5-5 10-7t11-2 11 2 10 7l197 197q9 9 9.5 21t-8.5 21-21.5 9-21.5-9L480-543z"/></svg></span>
<span :class="{ 'hidden' : open }" class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M480-357q-6 0-11-2t-10-7L261-564q-9-9-9-21t9-21 21.5-9 21.5 9l176 176 176-176q9-9 21-9t21 9 9 21.5-9 21.5L501-366q-5 5-10 7t-11 2z"/></svg></span></button><div x-show=open x-collapse class=px-4><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CgogIHJlZGlzOgogICAgaW1hZ2U6IHJlZGlzOmFscGluZQogICAgcG9ydHM6CiAgICAgIC0gIjYzNzkiCiAgICBuZXR3b3JrczoKICAgICAgLSBmcm9udGVuZAogICAgZGVwbG95OgogICAgICByZXBsaWNhczogMgogICAgICB1cGRhdGVfY29uZmlnOgogICAgICAgIHBhcmFsbGVsaXNtOiAyCiAgICAgICAgZGVsYXk6IDEwcwogICAgICByZXN0YXJ0X3BvbGljeToKICAgICAgICBjb25kaXRpb246IG9uLWZhaWx1cmUKCiAgZGI6CiAgICBpbWFnZTogcG9zdGdyZXM6OS40CiAgICB2b2x1bWVzOgogICAgICAtIGRiLWRhdGE6L3Zhci9saWIvcG9zdGdyZXNxbC9kYXRhCiAgICBuZXR3b3JrczoKICAgICAgLSBiYWNrZW5kCiAgICBkZXBsb3k6CiAgICAgIHBsYWNlbWVudDoKICAgICAgICBtYXhfcmVwbGljYXNfcGVyX25vZGU6IDEKICAgICAgICBjb25zdHJhaW50czoKICAgICAgICAgIC0gIm5vZGUucm9sZT09bWFuYWdlciIKCiAgdm90ZToKICAgIGltYWdlOiBkb2NrZXJzYW1wbGVzL2V4YW1wbGV2b3RpbmdhcHBfdm90ZTpiZWZvcmUKICAgIHBvcnRzOgogICAgICAtICI1MDAwOjgwIgogICAgbmV0d29ya3M6CiAgICAgIC0gZnJvbnRlbmQKICAgIGRlcGVuZHNfb246CiAgICAgIC0gcmVkaXMKICAgIGRlcGxveToKICAgICAgcmVwbGljYXM6IDIKICAgICAgdXBkYXRlX2NvbmZpZzoKICAgICAgICBwYXJhbGxlbGlzbTogMgogICAgICByZXN0YXJ0X3BvbGljeToKICAgICAgICBjb25kaXRpb246IG9uLWZhaWx1cmUKCiAgcmVzdWx0OgogICAgaW1hZ2U6IGRvY2tlcnNhbXBsZXMvZXhhbXBsZXZvdGluZ2FwcF9yZXN1bHQ6YmVmb3JlCiAgICBwb3J0czoKICAgICAgLSAiNTAwMTo4MCIKICAgIG5ldHdvcmtzOgogICAgICAtIGJhY2tlbmQKICAgIGRlcGVuZHNfb246CiAgICAgIC0gZGIKICAgIGRlcGxveToKICAgICAgcmVwbGljYXM6IDEKICAgICAgdXBkYXRlX2NvbmZpZzoKICAgICAgICBwYXJhbGxlbGlzbTogMgogICAgICAgIGRlbGF5OiAxMHMKICAgICAgcmVzdGFydF9wb2xpY3k6CiAgICAgICAgY29uZGl0aW9uOiBvbi1mYWlsdXJlCgogIHdvcmtlcjoKICAgIGltYWdlOiBkb2NrZXJzYW1wbGVzL2V4YW1wbGV2b3RpbmdhcHBfd29ya2VyCiAgICBuZXR3b3JrczoKICAgICAgLSBmcm9udGVuZAogICAgICAtIGJhY2tlbmQKICAgIGRlcGxveToKICAgICAgbW9kZTogcmVwbGljYXRlZAogICAgICByZXBsaWNhczogMQogICAgICBsYWJlbHM6IFtBUFA9Vk9USU5HXQogICAgICByZXN0YXJ0X3BvbGljeToKICAgICAgICBjb25kaXRpb246IG9uLWZhaWx1cmUKICAgICAgICBkZWxheTogMTBzCiAgICAgICAgbWF4X2F0dGVtcHRzOiAzCiAgICAgICAgd2luZG93OiAxMjBzCiAgICAgIHBsYWNlbWVudDoKICAgICAgICBjb25zdHJhaW50czoKICAgICAgICAgIC0gIm5vZGUucm9sZT09bWFuYWdlciIKCiAgdmlzdWFsaXplcjoKICAgIGltYWdlOiBkb2NrZXJzYW1wbGVzL3Zpc3VhbGl6ZXI6c3RhYmxlCiAgICBwb3J0czoKICAgICAgLSAiODA4MDo4MDgwIgogICAgc3RvcF9ncmFjZV9wZXJpb2Q6IDFtMzBzCiAgICB2b2x1bWVzOgogICAgICAtICIvdmFyL3J1bi9kb2NrZXIuc29jazovdmFyL3J1bi9kb2NrZXIuc29jayIKICAgIGRlcGxveToKICAgICAgcGxhY2VtZW50OgogICAgICAgIGNvbnN0cmFpbnRzOgogICAgICAgICAgLSAibm9kZS5yb2xlPT1tYW5hZ2VyIgoKbmV0d29ya3M6CiAgZnJvbnRlbmQ6CiAgYmFja2VuZDoKCnZvbHVtZXM6CiAgZGItZGF0YTo=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yml data-lang=yml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;6379&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>frontend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>update_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>parallelism</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>delay</span><span class=p>:</span><span class=w> </span><span class=l>10s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>restart_policy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>condition</span><span class=p>:</span><span class=w> </span><span class=kc>on</span>-<span class=l>failure</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>postgres:9.4</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>db-data:/var/lib/postgresql/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>backend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max_replicas_per_node</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>constraints</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=s2>&#34;node.role==manager&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>vote</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_vote:before</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;5000:80&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>frontend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>depends_on</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>redis</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>update_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>parallelism</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>restart_policy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>condition</span><span class=p>:</span><span class=w> </span><span class=kc>on</span>-<span class=l>failure</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>result</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_result:before</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;5001:80&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>backend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>depends_on</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>db</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>update_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>parallelism</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>delay</span><span class=p>:</span><span class=w> </span><span class=l>10s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>restart_policy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>condition</span><span class=p>:</span><span class=w> </span><span class=kc>on</span>-<span class=l>failure</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>worker</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_worker</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>frontend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>backend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>replicated</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>labels</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=l>APP=VOTING]</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>restart_policy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>condition</span><span class=p>:</span><span class=w> </span><span class=kc>on</span>-<span class=l>failure</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>delay</span><span class=p>:</span><span class=w> </span><span class=l>10s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max_attempts</span><span class=p>:</span><span class=w> </span><span class=m>3</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>window</span><span class=p>:</span><span class=w> </span><span class=l>120s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>constraints</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=s2>&#34;node.role==manager&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>visualizer</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/visualizer:stable</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;8080:8080&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>stop_grace_period</span><span class=p>:</span><span class=w> </span><span class=l>1m30s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;/var/run/docker.sock:/var/run/docker.sock&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>constraints</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=s2>&#34;node.role==manager&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>frontend</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>backend</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>db-data:</span></span></span></code></pre></div></div></div></div></div><p>The topics on this reference page are organized alphabetically by top-level key
to reflect the structure of the Compose file itself. Top-level keys that define
a section in the configuration file such as <code>build</code>, <code>deploy</code>, <code>depends_on</code>,
<code>networks</code>, and so on, are listed with the options that support them as
sub-topics. This maps to the <code>&lt;key>: &lt;option>: &lt;value></code> indent structure of the
Compose file.</p><h2 class=scroll-mt-20 id=service-configuration-reference><a class="text-black dark:text-white no-underline hover:underline" href="index.html#service-configuration-reference">Service configuration reference</a></h2><p>The Compose file is a
<a class=link href=https://yaml.org target=_blank rel=noopener>YAML<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a> file defining
<a class=link href="index.html#service-configuration-reference">services</a>,
<a class=link href="index.html#network-configuration-reference">networks</a> and
<a class=link href="index.html#volume-configuration-reference">volumes</a>.
The default path for a Compose file is <code>./docker-compose.yml</code>.</p><blockquote><p><strong>Tip</strong>: You can use either a <code>.yml</code> or <code>.yaml</code> extension for this file.
They both work.</p></blockquote><p>A service definition contains configuration that is applied to each
container started for that service, much like passing command-line parameters to
<code>docker run</code>. Likewise, network and volume definitions are analogous to
<code>docker network create</code> and <code>docker volume create</code>.</p><p>As with <code>docker run</code>, options specified in the Dockerfile, such as <code>CMD</code>,
<code>EXPOSE</code>, <code>VOLUME</code>, <code>ENV</code>, are respected by default - you don't need to
specify them again in <code>docker-compose.yml</code>.</p><p>You can use environment variables in configuration values with a Bash-like
<code>${VARIABLE}</code> syntax - see
<a class=link href="index.html#variable-substitution">variable substitution</a> for
full details.</p><p>This section contains a list of all configuration options supported by a service
definition in version 3.</p><h3 class=scroll-mt-20 id=build><a class="text-black dark:text-white no-underline hover:underline" href="index.html#build">build</a></h3><p>Configuration options that are applied at build time.</p><p><code>build</code> can be specified either as a string containing a path to the build
context:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViYXBwOgogICAgYnVpbGQ6IC4vZGly', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>webapp</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>build</span><span class=p>:</span><span class=w> </span><span class=l>./dir</span></span></span></code></pre></div></div></div><p>Or, as an object with the path specified under
<a class=link href="index.html#context">context</a> and
optionally
<a class=link href="index.html#dockerfile">Dockerfile</a> and
<a class=link href="index.html#args">args</a>:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViYXBwOgogICAgYnVpbGQ6CiAgICAgIGNvbnRleHQ6IC4vZGlyCiAgICAgIGRvY2tlcmZpbGU6IERvY2tlcmZpbGUtYWx0ZXJuYXRlCiAgICAgIGFyZ3M6CiAgICAgICAgYnVpbGRubzogMQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>webapp</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>./dir</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>dockerfile</span><span class=p>:</span><span class=w> </span><span class=l>Dockerfile-alternate</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>args</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>buildno</span><span class=p>:</span><span class=w> </span><span class=m>1</span></span></span></code></pre></div></div></div><p>If you specify <code>image</code> as well as <code>build</code>, then Compose names the built image
with the <code>webapp</code> and optional <code>tag</code> specified in <code>image</code>:</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6IC4vZGlyCmltYWdlOiB3ZWJhcHA6dGFn', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w> </span><span class=l>./dir</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>webapp:tag</span></span></span></code></pre></div></div></div><p>This results in an image named <code>webapp</code> and tagged <code>tag</code>, built from <code>./dir</code>.</p><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>build</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>
The <code>docker stack</code> command does not build images before deploying.</p></blockquote><h4 class=scroll-mt-20 id=context><a class="text-black dark:text-white no-underline hover:underline" href="index.html#context">context</a></h4><p>Either a path to a directory containing a Dockerfile, or a url to a git repository.</p><p>When the value supplied is a relative path, it is interpreted as relative to the
location of the Compose file. This directory is also the build context that is
sent to the Docker daemon.</p><p>Compose builds and tags it with a generated name, and uses that image
thereafter.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLi9kaXI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>./dir</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=dockerfile><a class="text-black dark:text-white no-underline hover:underline" href="index.html#dockerfile">dockerfile</a></h4><p>Alternate Dockerfile.</p><p>Compose uses an alternate file to build with. A build path must also be
specified.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIGRvY2tlcmZpbGU6IERvY2tlcmZpbGUtYWx0ZXJuYXRl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>dockerfile</span><span class=p>:</span><span class=w> </span><span class=l>Dockerfile-alternate</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=args><a class="text-black dark:text-white no-underline hover:underline" href="index.html#args">args</a></h4><p>Add build arguments, which are environment variables accessible only during the
build process.</p><p>First, specify the arguments in your Dockerfile:</p><div class="group relative"><button x-data="{ code: 'IyBzeW50YXg9ZG9ja2VyL2RvY2tlcmZpbGU6MQoKQVJHIGJ1aWxkbm8KQVJHIGdpdGNvbW1pdGhhc2gKClJVTiBlY2hvICJCdWlsZCBudW1iZXI6ICRidWlsZG5vIgpSVU4gZWNobyAiQmFzZWQgb24gY29tbWl0OiAkZ2l0Y29tbWl0aGFzaCI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-dockerfile data-lang=dockerfile><span class=line><span class=cl><span class=c># syntax=docker/dockerfile:1</span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=k>ARG</span> buildno<span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=k>ARG</span> gitcommithash<span class=err>
</span></span></span><span class=line><span class=cl><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=k>RUN</span> <span class=nb>echo</span> <span class=s2>&#34;Build number: </span><span class=nv>$buildno</span><span class=s2>&#34;</span><span class=err>
</span></span></span><span class=line><span class=cl><span class=err></span><span class=k>RUN</span> <span class=nb>echo</span> <span class=s2>&#34;Based on commit: </span><span class=nv>$gitcommithash</span><span class=s2>&#34;</span></span></span></code></pre></div></div></div><p>Then specify the arguments under the <code>build</code> key. You can pass a mapping
or a list:</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIGFyZ3M6CiAgICBidWlsZG5vOiAxCiAgICBnaXRjb21taXRoYXNoOiBjZGMzYjE5', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>args</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>buildno</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>gitcommithash</span><span class=p>:</span><span class=w> </span><span class=l>cdc3b19</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIGFyZ3M6CiAgICAtIGJ1aWxkbm89MQogICAgLSBnaXRjb21taXRoYXNoPWNkYzNiMTk=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>args</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=l>buildno=1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=l>gitcommithash=cdc3b19</span></span></span></code></pre></div></div></div><blockquote><p>Scope of build-args</p><p>In your Dockerfile, if you specify <code>ARG</code> before the <code>FROM</code> instruction,
<code>ARG</code> is not available in the build instructions under <code>FROM</code>.
If you need an argument to be available in both places, also specify it under
the <code>FROM</code> instruction. Refer to the
<a class=link href="../../../engine/reference/builder/index.html#understand-how-arg-and-from-interact">understand how ARGS and FROM interact</a>
section in the documentation for usage details.</p></blockquote><p>You can omit the value when specifying a build argument, in which case its value
at build time is the value in the environment where Compose is running.</p><div class="group relative"><button x-data="{ code: 'YXJnczoKICAtIGJ1aWxkbm8KICAtIGdpdGNvbW1pdGhhc2g=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>args</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>buildno</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>gitcommithash</span></span></span></code></pre></div></div></div><blockquote><p>Tip when using boolean values</p><p>YAML boolean values (<code>"true"</code>, <code>"false"</code>, <code>"yes"</code>, <code>"no"</code>, <code>"on"</code>,
<code>"off"</code>) must be enclosed in quotes, so that the parser interprets them as
strings.</p></blockquote><h4 class=scroll-mt-20 id=cache_from><a class="text-black dark:text-white no-underline hover:underline" href="index.html#cache_from">cache_from</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-32">version 3.2</a> file format</p></blockquote><p>A list of images that the engine uses for cache resolution.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIGNhY2hlX2Zyb206CiAgICAtIGFscGluZTpsYXRlc3QKICAgIC0gY29ycC93ZWJfYXBwOjMuMTQ=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>cache_from</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=l>alpine:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=l>corp/web_app:3.14</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=labels><a class="text-black dark:text-white no-underline hover:underline" href="index.html#labels">labels</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-33">version 3.3</a> file format</p></blockquote><p>Add metadata to the resulting image using
<a class=link href="../../../engine/userguide/labels-custom-metadata/index.html">Docker labels</a>.
You can use either an array or a dictionary.</p><p>It's recommended that you use reverse-DNS notation to prevent your labels from
conflicting with those used by other software.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIGxhYmVsczoKICAgIGNvbS5leGFtcGxlLmRlc2NyaXB0aW9uOiAiQWNjb3VudGluZyB3ZWJhcHAiCiAgICBjb20uZXhhbXBsZS5kZXBhcnRtZW50OiAiRmluYW5jZSIKICAgIGNvbS5leGFtcGxlLmxhYmVsLXdpdGgtZW1wdHktdmFsdWU6ICIi', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>com.example.description</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Accounting webapp&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>com.example.department</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Finance&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>com.example.label-with-empty-value</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIGxhYmVsczoKICAgIC0gImNvbS5leGFtcGxlLmRlc2NyaXB0aW9uPUFjY291bnRpbmcgd2ViYXBwIgogICAgLSAiY29tLmV4YW1wbGUuZGVwYXJ0bWVudD1GaW5hbmNlIgogICAgLSAiY29tLmV4YW1wbGUubGFiZWwtd2l0aC1lbXB0eS12YWx1ZSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=s2>&#34;com.example.description=Accounting webapp&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=s2>&#34;com.example.department=Finance&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=s2>&#34;com.example.label-with-empty-value&#34;</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=network><a class="text-black dark:text-white no-underline hover:underline" href="index.html#network">network</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format</p></blockquote><p>Set the network containers connect to for the <code>RUN</code> instructions during
build.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIG5ldHdvcms6IGhvc3Q=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>network</span><span class=p>:</span><span class=w> </span><span class=l>host</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIG5ldHdvcms6IGN1c3RvbV9uZXR3b3JrXzE=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>network</span><span class=p>:</span><span class=w> </span><span class=l>custom_network_1</span></span></span></code></pre></div></div></div><p>Use <code>none</code> to disable networking during build:</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIG5ldHdvcms6IG5vbmU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>network</span><span class=p>:</span><span class=w> </span><span class=l>none</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=shm_size><a class="text-black dark:text-white no-underline hover:underline" href="index.html#shm_size">shm_size</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-35">version 3.5</a> file format</p></blockquote><p>Set the size of the <code>/dev/shm</code> partition for this build's containers. Specify
as an integer value representing the number of bytes or as a string expressing
a
<a class=link href="index.html#specifying-byte-values">byte value</a>.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIHNobV9zaXplOiAnMmdiJw==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>shm_size</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;2gb&#39;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIHNobV9zaXplOiAxMDAwMDAwMA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>shm_size</span><span class=p>:</span><span class=w> </span><span class=m>10000000</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=target><a class="text-black dark:text-white no-underline hover:underline" href="index.html#target">target</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format</p></blockquote><p>Build the specified stage as defined inside the <code>Dockerfile</code>. See the
<a class=link href="../../../build/building/multi-stage.html">multi-stage build docs</a> for
details.</p><div class="group relative"><button x-data="{ code: 'YnVpbGQ6CiAgY29udGV4dDogLgogIHRhcmdldDogcHJvZA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>prod</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=cap_add-cap_drop><a class="text-black dark:text-white no-underline hover:underline" href="index.html#cap_add-cap_drop">cap_add, cap_drop</a></h3><p>Add or drop container capabilities.
See <code>man 7 capabilities</code> for a full list.</p><div class="group relative"><button x-data="{ code: 'Y2FwX2FkZDoKICAtIEFMTAoKY2FwX2Ryb3A6CiAgLSBORVRfQURNSU4KICAtIFNZU19BRE1JTg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>cap_add</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>ALL</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>cap_drop</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>NET_ADMIN</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>SYS_ADMIN</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=cgroup_parent><a class="text-black dark:text-white no-underline hover:underline" href="index.html#cgroup_parent">cgroup_parent</a></h3><p>Specify an optional parent cgroup for the container.</p><div class="group relative"><button x-data="{ code: 'Y2dyb3VwX3BhcmVudDogbS1leGVjdXRvci1hYmNk', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>cgroup_parent</span><span class=p>:</span><span class=w> </span><span class=l>m-executor-abcd</span></span></span></code></pre></div></div></div><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>cgroup_parent</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a></p></blockquote><h3 class=scroll-mt-20 id=command><a class="text-black dark:text-white no-underline hover:underline" href="index.html#command">command</a></h3><p>Override the default command.</p><div class="group relative"><button x-data="{ code: 'Y29tbWFuZDogYnVuZGxlIGV4ZWMgdGhpbiAtcCAzMDAw', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>command</span><span class=p>:</span><span class=w> </span><span class=l>bundle exec thin -p 3000</span></span></span></code></pre></div></div></div><p>The command can also be a list, in a manner similar to
<a class=link href="../../../engine/reference/builder/index.html#cmd">dockerfile</a>:</p><div class="group relative"><button x-data="{ code: 'Y29tbWFuZDogWyJidW5kbGUiLCAiZXhlYyIsICJ0aGluIiwgIi1wIiwgIjMwMDAiXQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>command</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;bundle&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;exec&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;thin&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;-p&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;3000&#34;</span><span class=p>]</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=configs><a class="text-black dark:text-white no-underline hover:underline" href="index.html#configs">configs</a></h3><p>Grant access to configs on a per-service basis using the per-service <code>configs</code>
configuration. Two different syntax variants are supported.</p><blockquote><p><strong>Note</strong>: The config must already exist or be
<a class=link href="index.html#configs-configuration-reference">defined in the top-level <code>configs</code> configuration</a>
of this stack file, or stack deployment fails.</p></blockquote><p>For more information on configs, see
<a class=link href="../../../engine/swarm/configs/index.html">configs</a>.</p><h4 class=scroll-mt-20 id=short-syntax><a class="text-black dark:text-white no-underline hover:underline" href="index.html#short-syntax">Short syntax</a></h4><p>The short syntax variant only specifies the config name. This grants the
container access to the config and mounts it at <code>/&lt;config_name></code>
within the container. The source name and destination mountpoint are both set
to the config name.</p><p>The following example uses the short syntax to grant the <code>redis</code> service
access to the <code>my_config</code> and <code>my_other_config</code> configs. The value of
<code>my_config</code> is set to the contents of the file <code>./my_config.txt</code>, and
<code>my_other_config</code> is defined as an external resource, which means that it has
already been defined in Docker, either by running the <code>docker config create</code>
command or by another stack deployment. If the external config does not exist,
the stack deployment fails with a <code>config not found</code> error.</p><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-33">version 3.3</a> file format.</p><p><code>config</code> definitions are only supported in version 3.3 and higher of the
compose file format.</p></blockquote><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6bGF0ZXN0CiAgICBkZXBsb3k6CiAgICAgIHJlcGxpY2FzOiAxCiAgICBjb25maWdzOgogICAgICAtIG15X2NvbmZpZwogICAgICAtIG15X290aGVyX2NvbmZpZwpjb25maWdzOgogIG15X2NvbmZpZzoKICAgIGZpbGU6IC4vbXlfY29uZmlnLnR4dAogIG15X290aGVyX2NvbmZpZzoKICAgIGV4dGVybmFsOiB0cnVl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>my_config</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>my_other_config</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./my_config.txt</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_other_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=long-syntax><a class="text-black dark:text-white no-underline hover:underline" href="index.html#long-syntax">Long syntax</a></h4><p>The long syntax provides more granularity in how the config is created within
the service's task containers.</p><ul><li><code>source</code>: The identifier of the config as it is defined in this configuration.</li><li><code>target</code>: The path and name of the file to be mounted in the service's
task containers. Defaults to <code>/&lt;source></code> if not specified.</li><li><code>uid</code> and <code>gid</code>: The numeric UID or GID that owns the mounted config file
within in the service's task containers. Both default to <code>0</code> on Linux if not
specified. Not supported on Windows.</li><li><code>mode</code>: The permissions for the file that is mounted within the service's
task containers, in octal notation. For instance, <code>0444</code>
represents world-readable. The default is <code>0444</code>. Configs cannot be writable
because they are mounted in a temporary filesystem, so if you set the writable
bit, it is ignored. The executable bit can be set. If you aren't familiar with
UNIX file permission modes, you may find this
<a class=link href=http://permissions-calculator.org/ target=_blank rel=noopener>permissions calculator<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
useful.</li></ul><p>The following example sets the name of <code>my_config</code> to <code>redis_config</code> within the
container, sets the mode to <code>0440</code> (group-readable) and sets the user and group
to <code>103</code>. The <code>redis</code> service does not have access to the <code>my_other_config</code>
config.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6bGF0ZXN0CiAgICBkZXBsb3k6CiAgICAgIHJlcGxpY2FzOiAxCiAgICBjb25maWdzOgogICAgICAtIHNvdXJjZTogbXlfY29uZmlnCiAgICAgICAgdGFyZ2V0OiAvcmVkaXNfY29uZmlnCiAgICAgICAgdWlkOiAnMTAzJwogICAgICAgIGdpZDogJzEwMycKICAgICAgICBtb2RlOiAwNDQwCmNvbmZpZ3M6CiAgbXlfY29uZmlnOgogICAgZmlsZTogLi9teV9jb25maWcudHh0CiAgbXlfb3RoZXJfY29uZmlnOgogICAgZXh0ZXJuYWw6IHRydWU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=nt>source</span><span class=p>:</span><span class=w> </span><span class=l>my_config</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>/redis_config</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>uid</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;103&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>gid</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;103&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=m>0440</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./my_config.txt</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_other_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><p>You can grant a service access to multiple configs and you can mix long and
short syntax. Defining a config does not imply granting a service access to it.</p><h3 class=scroll-mt-20 id=container_name><a class="text-black dark:text-white no-underline hover:underline" href="index.html#container_name">container_name</a></h3><p>Specify a custom container name, rather than a generated default name.</p><div class="group relative"><button x-data="{ code: 'Y29udGFpbmVyX25hbWU6IG15LXdlYi1jb250YWluZXI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>container_name</span><span class=p>:</span><span class=w> </span><span class=l>my-web-container</span></span></span></code></pre></div></div></div><p>Because Docker container names must be unique, you cannot scale a service beyond
1 container if you have specified a custom name. Attempting to do so results in
an error.</p><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>container_name</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a></p></blockquote><h3 class=scroll-mt-20 id=credential_spec><a class="text-black dark:text-white no-underline hover:underline" href="index.html#credential_spec">credential_spec</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-33">version 3.3</a> file format.</p><p>The <code>credential_spec</code> option was added in v3.3. Using group Managed Service
Account (gMSA) configurations with compose files is supported in file format
version 3.8 or up.</p></blockquote><p>Configure the credential spec for managed service account. This option is only
used for services using Windows containers. The <code>credential_spec</code> must be in the
format <code>file://&lt;filename></code> or <code>registry://&lt;value-name></code>.</p><p>When using <code>file:</code>, the referenced file must be present in the <code>CredentialSpecs</code>
subdirectory in the Docker data directory, which defaults to <code>C:\ProgramData\Docker\</code>
on Windows. The following example loads the credential spec from a file named
<code>C:\ProgramData\Docker\CredentialSpecs\my-credential-spec.json</code>.</p><div class="group relative"><button x-data="{ code: 'Y3JlZGVudGlhbF9zcGVjOgogIGZpbGU6IG15LWNyZWRlbnRpYWwtc3BlYy5qc29u', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>credential_spec</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>my-credential-spec.json</span></span></span></code></pre></div></div></div><p>When using <code>registry:</code>, the credential spec is read from the Windows registry on
the daemon's host. A registry value with the given name must be located in:</p><pre><code>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs
</code></pre><p>The following example load the credential spec from a value named <code>my-credential-spec</code>
in the registry:</p><div class="group relative"><button x-data="{ code: 'Y3JlZGVudGlhbF9zcGVjOgogIHJlZ2lzdHJ5OiBteS1jcmVkZW50aWFsLXNwZWM=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>credential_spec</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>registry</span><span class=p>:</span><span class=w> </span><span class=l>my-credential-spec</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=example-gmsa-configuration><a class="text-black dark:text-white no-underline hover:underline" href="index.html#example-gmsa-configuration">Example gMSA configuration</a></h4><p>When configuring a gMSA credential spec for a service, you only need
to specify a credential spec with <code>config</code>, as shown in the following example:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgbXlzZXJ2aWNlOgogICAgaW1hZ2U6IG15aW1hZ2U6bGF0ZXN0CiAgICBjcmVkZW50aWFsX3NwZWM6CiAgICAgIGNvbmZpZzogbXlfY3JlZGVudGlhbF9zcGVjCgpjb25maWdzOgogIG15X2NyZWRlbnRpYWxzX3NwZWM6CiAgICBmaWxlOiAuL215LWNyZWRlbnRpYWwtc3BlYy5qc29ufA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>myservice</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>myimage:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>credential_spec</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>config</span><span class=p>:</span><span class=w> </span><span class=l>my_credential_spec</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_credentials_spec</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./my-credential-spec.json|</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=depends_on><a class="text-black dark:text-white no-underline hover:underline" href="index.html#depends_on">depends_on</a></h3><p>Express dependency between services. Service dependencies cause the following
behaviors:</p><ul><li><code>docker-compose up</code> starts services in dependency order. In the following
example, <code>db</code> and <code>redis</code> are started before <code>web</code>.</li><li><code>docker-compose up SERVICE</code> automatically includes <code>SERVICE</code>'s
dependencies. In the example below, <code>docker-compose up web</code> also
creates and starts <code>db</code> and <code>redis</code>.</li><li><code>docker-compose stop</code> stops services in dependency order. In the following
example, <code>web</code> is stopped before <code>db</code> and <code>redis</code>.</li></ul><p>Simple example:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgYnVpbGQ6IC4KICAgIGRlcGVuZHNfb246CiAgICAgIC0gZGIKICAgICAgLSByZWRpcwogIHJlZGlzOgogICAgaW1hZ2U6IHJlZGlzCiAgZGI6CiAgICBpbWFnZTogcG9zdGdyZXM=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>build</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>depends_on</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>db</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>redis</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>postgres</span></span></span></code></pre></div></div></div><blockquote><p>There are several things to be aware of when using <code>depends_on</code>:</p><ul><li><code>depends_on</code> does not wait for <code>db</code> and <code>redis</code> to be "ready" before
starting <code>web</code> - only until they have been started. If you need to wait
for a service to be ready, see
<a class=link href="../../startup-order/index.html">Controlling startup order</a>
for more on this problem and strategies for solving it.</li><li>The <code>depends_on</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>
with a version 3 Compose file.</li></ul></blockquote><h3 class=scroll-mt-20 id=deploy><a class="text-black dark:text-white no-underline hover:underline" href="index.html#deploy">deploy</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-3">version 3</a> file format.</p></blockquote><p>Specify configuration related to the deployment and running of services. The following<br>sub-options only takes effect when deploying to a <a class=link href="../../../engine/swarm/index.html">swarm</a> with
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">docker stack deploy</a>, and is
ignored by <code>docker-compose up</code> and <code>docker-compose run</code>, except for <code>resources</code>.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6YWxwaW5lCiAgICBkZXBsb3k6CiAgICAgIHJlcGxpY2FzOiA2CiAgICAgIHBsYWNlbWVudDoKICAgICAgICBtYXhfcmVwbGljYXNfcGVyX25vZGU6IDEKICAgICAgdXBkYXRlX2NvbmZpZzoKICAgICAgICBwYXJhbGxlbGlzbTogMgogICAgICAgIGRlbGF5OiAxMHMKICAgICAgcmVzdGFydF9wb2xpY3k6CiAgICAgICAgY29uZGl0aW9uOiBvbi1mYWlsdXJl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>6</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max_replicas_per_node</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>update_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>parallelism</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>delay</span><span class=p>:</span><span class=w> </span><span class=l>10s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>restart_policy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>condition</span><span class=p>:</span><span class=w> </span><span class=kc>on</span>-<span class=l>failure</span></span></span></code></pre></div></div></div><p>Several sub-options are available:</p><h4 class=scroll-mt-20 id=endpoint_mode><a class="text-black dark:text-white no-underline hover:underline" href="index.html#endpoint_mode">endpoint_mode</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-32">version 3.2</a> file format.</p></blockquote><p>Specify a service discovery method for external clients connecting to a swarm.</p><ul><li><p><code>endpoint_mode: vip</code> - Docker assigns the service a virtual IP (VIP)
that acts as the front end for clients to reach the service on a
network. Docker routes requests between the client and available worker
nodes for the service, without client knowledge of how many nodes
are participating in the service or their IP addresses or ports.
(This is the default.)</p></li><li><p><code>endpoint_mode: dnsrr</code> - DNS round-robin (DNSRR) service discovery does
not use a single virtual IP. Docker sets up DNS entries for the service
such that a DNS query for the service name returns a list of IP addresses,
and the client connects directly to one of these. DNS round-robin is useful
in cases where you want to use your own load balancer, or for Hybrid
Windows and Linux applications.</p></li></ul><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKCnNlcnZpY2VzOgogIHdvcmRwcmVzczoKICAgIGltYWdlOiB3b3JkcHJlc3MKICAgIHBvcnRzOgogICAgICAtICI4MDgwOjgwIgogICAgbmV0d29ya3M6CiAgICAgIC0gb3ZlcmxheQogICAgZGVwbG95OgogICAgICBtb2RlOiByZXBsaWNhdGVkCiAgICAgIHJlcGxpY2FzOiAyCiAgICAgIGVuZHBvaW50X21vZGU6IHZpcAoKICBteXNxbDoKICAgIGltYWdlOiBteXNxbAogICAgdm9sdW1lczoKICAgICAgIC0gZGItZGF0YTovdmFyL2xpYi9teXNxbC9kYXRhCiAgICBuZXR3b3JrczoKICAgICAgIC0gb3ZlcmxheQogICAgZGVwbG95OgogICAgICBtb2RlOiByZXBsaWNhdGVkCiAgICAgIHJlcGxpY2FzOiAyCiAgICAgIGVuZHBvaW50X21vZGU6IGRuc3JyCgp2b2x1bWVzOgogIGRiLWRhdGE6CgpuZXR3b3JrczoKICBvdmVybGF5Og==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>wordpress</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>wordpress</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;8080:80&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>overlay</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>replicated</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>endpoint_mode</span><span class=p>:</span><span class=w> </span><span class=l>vip</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>mysql</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>mysql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>       </span>- <span class=l>db-data:/var/lib/mysql/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>       </span>- <span class=l>overlay</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>replicated</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>endpoint_mode</span><span class=p>:</span><span class=w> </span><span class=l>dnsrr</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db-data</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>overlay:</span></span></span></code></pre></div></div></div><p>The options for <code>endpoint_mode</code> also work as flags on the swarm mode CLI command
<a class=link href="../../../reference/cli/docker/service/create/index.html">docker service create</a>. For a
quick list of all swarm related <code>docker</code> commands, see
<a class=link href="../../../engine/swarm/index.html#swarm-mode-key-concepts-and-tutorial">Swarm mode CLI commands</a>.</p><p>To learn more about service discovery and networking in swarm mode, see
<a class=link href="../../../engine/swarm/networking/index.html#configure-service-discovery">Configure service discovery</a>
in the swarm mode topics.</p><h4 class=scroll-mt-20 id=labels-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#labels-1">labels</a></h4><p>Specify labels for the service. These labels are <em>only</em> set on the service,
and <em>not</em> on any containers for the service.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgaW1hZ2U6IHdlYgogICAgZGVwbG95OgogICAgICBsYWJlbHM6CiAgICAgICAgY29tLmV4YW1wbGUuZGVzY3JpcHRpb246ICJUaGlzIGxhYmVsIHdpbGwgYXBwZWFyIG9uIHRoZSB3ZWIgc2VydmljZSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>web</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>com.example.description</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;This label will appear on the web service&#34;</span></span></span></code></pre></div></div></div><p>To set labels on containers instead, use the <code>labels</code> key outside of <code>deploy</code>:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgaW1hZ2U6IHdlYgogICAgbGFiZWxzOgogICAgICBjb20uZXhhbXBsZS5kZXNjcmlwdGlvbjogIlRoaXMgbGFiZWwgd2lsbCBhcHBlYXIgb24gYWxsIGNvbnRhaW5lcnMgZm9yIHRoZSB3ZWIgc2VydmljZSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>web</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>com.example.description</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;This label will appear on all containers for the web service&#34;</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=mode><a class="text-black dark:text-white no-underline hover:underline" href="index.html#mode">mode</a></h4><p>Either <code>global</code> (exactly one container per swarm node) or <code>replicated</code> (a
specified number of containers). The default is <code>replicated</code>. (To learn more,
see
<a class=link href="../../../engine/swarm/how-swarm-mode-works/services/index.html#replicated-and-global-services">Replicated and global services</a>
in the <a class=link href="../../../engine/swarm/index.html">swarm</a> topics.)</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd29ya2VyOgogICAgaW1hZ2U6IGRvY2tlcnNhbXBsZXMvZXhhbXBsZXZvdGluZ2FwcF93b3JrZXIKICAgIGRlcGxveToKICAgICAgbW9kZTogZ2xvYmFs', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>worker</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_worker</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>global</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=placement><a class="text-black dark:text-white no-underline hover:underline" href="index.html#placement">placement</a></h4><p>Specify placement of constraints and preferences. See the docker service create
documentation for a full description of the syntax and available types of
<a class=link href="../../../reference/cli/docker/service/create/index.html#constraint">constraints</a>,
<a class=link href="../../../reference/cli/docker/service/create/index.html#placement-pref">preferences</a>,
and
<a class=link href="../../../reference/cli/docker/service/create/index.html#replicas-max-per-node">specifying the maximum replicas per node</a></p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgZGI6CiAgICBpbWFnZTogcG9zdGdyZXMKICAgIGRlcGxveToKICAgICAgcGxhY2VtZW50OgogICAgICAgIGNvbnN0cmFpbnRzOgogICAgICAgICAgLSAibm9kZS5yb2xlPT1tYW5hZ2VyIgogICAgICAgICAgLSAiZW5naW5lLmxhYmVscy5vcGVyYXRpbmdzeXN0ZW09PXVidW50dSAyMi4wNCIKICAgICAgICBwcmVmZXJlbmNlczoKICAgICAgICAgIC0gc3ByZWFkOiBub2RlLmxhYmVscy56b25l', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>postgres</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>constraints</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=s2>&#34;node.role==manager&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=s2>&#34;engine.labels.operatingsystem==ubuntu 22.04&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>preferences</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=nt>spread</span><span class=p>:</span><span class=w> </span><span class=l>node.labels.zone</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=max_replicas_per_node><a class="text-black dark:text-white no-underline hover:underline" href="index.html#max_replicas_per_node">max_replicas_per_node</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-38">version 3.8</a> file format.</p></blockquote><p>If the service is <code>replicated</code> (which is the default),
<a class=link href="../../../reference/cli/docker/service/create/index.html#replicas-max-per-node">limit the number of replicas</a>
that can run on a node at any time.</p><p>When there are more tasks requested than running nodes, an error
<code>no suitable node (max replicas per node limit exceed)</code> is raised.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd29ya2VyOgogICAgaW1hZ2U6IGRvY2tlcnNhbXBsZXMvZXhhbXBsZXZvdGluZ2FwcF93b3JrZXIKICAgIG5ldHdvcmtzOgogICAgICAtIGZyb250ZW5kCiAgICAgIC0gYmFja2VuZAogICAgZGVwbG95OgogICAgICBtb2RlOiByZXBsaWNhdGVkCiAgICAgIHJlcGxpY2FzOiA2CiAgICAgIHBsYWNlbWVudDoKICAgICAgICBtYXhfcmVwbGljYXNfcGVyX25vZGU6IDE=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>worker</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_worker</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>frontend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>backend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>replicated</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>6</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max_replicas_per_node</span><span class=p>:</span><span class=w> </span><span class=m>1</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=replicas><a class="text-black dark:text-white no-underline hover:underline" href="index.html#replicas">replicas</a></h4><p>If the service is <code>replicated</code> (which is the default), specify the number of
containers that should be running at any given time.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd29ya2VyOgogICAgaW1hZ2U6IGRvY2tlcnNhbXBsZXMvZXhhbXBsZXZvdGluZ2FwcF93b3JrZXIKICAgIG5ldHdvcmtzOgogICAgICAtIGZyb250ZW5kCiAgICAgIC0gYmFja2VuZAogICAgZGVwbG95OgogICAgICBtb2RlOiByZXBsaWNhdGVkCiAgICAgIHJlcGxpY2FzOiA2', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>worker</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_worker</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>frontend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>backend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>replicated</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>6</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=resources><a class="text-black dark:text-white no-underline hover:underline" href="index.html#resources">resources</a></h4><p>Configures resource constraints.</p><blockquote><p>Changed in compose-file version 3</p><p>The <code>resources</code> section replaces the
<a class=link href="../compose-file-v2/index.html#cpu-and-other-resources">older resource constraint options</a>
in Compose files prior to version 3 (<code>cpu_shares</code>, <code>cpu_quota</code>, <code>cpuset</code>,
<code>mem_limit</code>, <code>memswap_limit</code>, <code>mem_swappiness</code>).
Refer to
<a class=link href="../compose-versioning/index.html#upgrading">Upgrading version 2.x to 3.x</a>
to learn about differences between version 2 and 3 of the compose-file format.</p></blockquote><p>Each of these is a single value, analogous to its
<a class=link href="../../../reference/cli/docker/service/create/index.html">docker service create</a> counterpart.</p><p>In this general example, the <code>redis</code> service is constrained to use no more than
50M of memory and <code>0.50</code> (50% of a single core) of available processing time (CPU),
and has <code>20M</code> of memory and <code>0.25</code> CPU time reserved (as always available to it).</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6YWxwaW5lCiAgICBkZXBsb3k6CiAgICAgIHJlc291cmNlczoKICAgICAgICBsaW1pdHM6CiAgICAgICAgICBjcHVzOiAnMC41MCcKICAgICAgICAgIG1lbW9yeTogNTBNCiAgICAgICAgcmVzZXJ2YXRpb25zOgogICAgICAgICAgY3B1czogJzAuMjUnCiAgICAgICAgICBtZW1vcnk6IDIwTQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>resources</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>limits</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span><span class=nt>cpus</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;0.50&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span><span class=nt>memory</span><span class=p>:</span><span class=w> </span><span class=l>50M</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>reservations</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span><span class=nt>cpus</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;0.25&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span><span class=nt>memory</span><span class=p>:</span><span class=w> </span><span class=l>20M</span></span></span></code></pre></div></div></div><p>The topics below describe available options to set resource constraints on
services or containers in a swarm.</p><blockquote class=important><p>Looking for options to set resources on non swarm mode containers?</p><p>The options described here are specific to the
<code>deploy</code> key and swarm mode. If you want to set resource constraints
on non swarm deployments, use
<a class=link href="../compose-file-v2/index.html#cpu-and-other-resources">Compose file format version 2 CPU, memory, and other resource options</a>.
If you have further questions, refer to the discussion on the GitHub
issue
<a class=link href=https://github.com/docker/compose/issues/4513 target=_blank rel=noopener>docker/compose/4513<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p></blockquote><h5 class=scroll-mt-20 id=out-of-memory-exceptions-oome><a class="text-black dark:text-white no-underline hover:underline" href="index.html#out-of-memory-exceptions-oome">Out Of Memory Exceptions (OOME)</a></h5><p>If your services or containers attempt to use more memory than the system has
available, you may experience an Out Of Memory Exception (OOME) and a container,
or the Docker daemon, might be killed by the kernel OOM killer. To prevent this
from happening, ensure that your application runs on hosts with adequate memory
and see
<a class=link href="../../../config/containers/resource_constraints/index.html#understand-the-risks-of-running-out-of-memory">Understand the risks of running out of memory</a>.</p><h4 class=scroll-mt-20 id=restart_policy><a class="text-black dark:text-white no-underline hover:underline" href="index.html#restart_policy">restart_policy</a></h4><p>Configures if and how to restart containers when they exit. Replaces
<a class=link href="../compose-file-v2/index.html#orig-resources"><code>restart</code></a>.</p><ul><li><code>condition</code>: One of <code>none</code>, <code>on-failure</code> or <code>any</code> (default: <code>any</code>).</li><li><code>delay</code>: How long to wait between restart attempts, specified as a
<a class=link href="index.html#specifying-durations">duration</a> (default: 5s).</li><li><code>max_attempts</code>: How many times to attempt to restart a container before giving
up (default: never give up). If the restart does not succeed within the configured
<code>window</code>, this attempt doesn't count toward the configured <code>max_attempts</code> value.
For example, if <code>max_attempts</code> is set to '2', and the restart fails on the first
attempt, more than two restarts may be attempted.</li><li><code>window</code>: How long to wait before deciding if a restart has succeeded,
specified as a
<a class=link href="index.html#specifying-durations">duration</a> (default:
decide immediately).</li></ul><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6YWxwaW5lCiAgICBkZXBsb3k6CiAgICAgIHJlc3RhcnRfcG9saWN5OgogICAgICAgIGNvbmRpdGlvbjogb24tZmFpbHVyZQogICAgICAgIGRlbGF5OiA1cwogICAgICAgIG1heF9hdHRlbXB0czogMwogICAgICAgIHdpbmRvdzogMTIwcw==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>restart_policy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>condition</span><span class=p>:</span><span class=w> </span><span class=kc>on</span>-<span class=l>failure</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>delay</span><span class=p>:</span><span class=w> </span><span class=l>5s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max_attempts</span><span class=p>:</span><span class=w> </span><span class=m>3</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>window</span><span class=p>:</span><span class=w> </span><span class=l>120s</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=rollback_config><a class="text-black dark:text-white no-underline hover:underline" href="index.html#rollback_config">rollback_config</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-37">version 3.7</a> file format.</p></blockquote><p>Configures how the service should be rollbacked in case of a failing
update.</p><ul><li><code>parallelism</code>: The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously.</li><li><code>delay</code>: The time to wait between each container group's rollback (default 0s).</li><li><code>failure_action</code>: What to do if a rollback fails. One of <code>continue</code> or <code>pause</code> (default <code>pause</code>)</li><li><code>monitor</code>: Duration after each task update to monitor for failure <code>(ns|us|ms|s|m|h)</code> (default 5s) <strong>Note</strong>: Setting to 0 will use the default 5s.</li><li><code>max_failure_ratio</code>: Failure rate to tolerate during a rollback (default 0).</li><li><code>order</code>: Order of operations during rollbacks. One of <code>stop-first</code> (old task is stopped before starting new one), or <code>start-first</code> (new task is started first, and the running tasks briefly overlap) (default <code>stop-first</code>).</li></ul><h4 class=scroll-mt-20 id=update_config><a class="text-black dark:text-white no-underline hover:underline" href="index.html#update_config">update_config</a></h4><p>Configures how the service should be updated. Useful for configuring rolling
updates.</p><ul><li><code>parallelism</code>: The number of containers to update at a time.</li><li><code>delay</code>: The time to wait between updating a group of containers.</li><li><code>failure_action</code>: What to do if an update fails. One of <code>continue</code>, <code>rollback</code>, or <code>pause</code>
(default: <code>pause</code>).</li><li><code>monitor</code>: Duration after each task update to monitor for failure <code>(ns|us|ms|s|m|h)</code> (default 5s) <strong>Note</strong>: Setting to 0 will use the default 5s.</li><li><code>max_failure_ratio</code>: Failure rate to tolerate during an update.</li><li><code>order</code>: Order of operations during updates. One of <code>stop-first</code> (old task is stopped before starting new one), or <code>start-first</code> (new task is started first, and the running tasks briefly overlap) (default <code>stop-first</code>) <strong>Note</strong>: Only supported for v3.4 and higher.</li></ul><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format.</p><p>The <code>order</code> option is only supported by v3.4 and higher of the compose
file format.</p></blockquote><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgdm90ZToKICAgIGltYWdlOiBkb2NrZXJzYW1wbGVzL2V4YW1wbGV2b3RpbmdhcHBfdm90ZTpiZWZvcmUKICAgIGRlcGVuZHNfb246CiAgICAgIC0gcmVkaXMKICAgIGRlcGxveToKICAgICAgcmVwbGljYXM6IDIKICAgICAgdXBkYXRlX2NvbmZpZzoKICAgICAgICBwYXJhbGxlbGlzbTogMgogICAgICAgIGRlbGF5OiAxMHMKICAgICAgICBvcmRlcjogc3RvcC1maXJzdA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>vote</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>dockersamples/examplevotingapp_vote:before</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>depends_on</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>redis</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>update_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>parallelism</span><span class=p>:</span><span class=w> </span><span class=m>2</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>delay</span><span class=p>:</span><span class=w> </span><span class=l>10s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>order</span><span class=p>:</span><span class=w> </span><span class=l>stop-first</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=not-supported-for-docker-stack-deploy><a class="text-black dark:text-white no-underline hover:underline" href="index.html#not-supported-for-docker-stack-deploy">Not supported for docker stack deploy</a></h4><p>The following sub-options (supported for <code>docker-compose up</code> and <code>docker-compose run</code>) are <em>not supported</em> for <code>docker stack deploy</code> or the <code>deploy</code> key.</p><ul><li><a class=link href="index.html#build">build</a></li><li><a class=link href="index.html#cgroup_parent">cgroup_parent</a></li><li><a class=link href="index.html#container_name">container_name</a></li><li><a class=link href="index.html#devices">devices</a></li><li><a class=link href="index.html#tmpfs">tmpfs</a></li><li><a class=link href="index.html#external_links">external_links</a></li><li><a class=link href="index.html#links">links</a></li><li><a class=link href="index.html#network_mode">network_mode</a></li><li><a class=link href="index.html#restart">restart</a></li><li><a class=link href="index.html#security_opt">security_opt</a></li><li><a class=link href="index.html#userns_mode">userns_mode</a></li></ul><blockquote><p>Tip</p><p>See the section on
<a class=link href="index.html#volumes-for-services-swarms-and-stack-files">how to configure volumes for services, swarms, and docker-stack.yml
files</a>. Volumes <em>are</em> supported
but to work with swarms and services, they must be configured as named volumes
or associated with services that are constrained to nodes with access to the
requisite volumes.</p></blockquote><h3 class=scroll-mt-20 id=devices><a class="text-black dark:text-white no-underline hover:underline" href="index.html#devices">devices</a></h3><p>List of device mappings. Uses the same format as the <code>--device</code> docker
client create option.</p><div class="group relative"><button x-data="{ code: 'ZGV2aWNlczoKICAtICIvZGV2L3R0eVVTQjA6L2Rldi90dHlVU0IwIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>devices</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;/dev/ttyUSB0:/dev/ttyUSB0&#34;</span></span></span></code></pre></div></div></div><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>devices</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a></p></blockquote><h3 class=scroll-mt-20 id=dns><a class="text-black dark:text-white no-underline hover:underline" href="index.html#dns">dns</a></h3><p>Custom DNS servers. Can be a single value or a list.</p><div class="group relative"><button x-data="{ code: 'ZG5zOiA4LjguOC44', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>dns</span><span class=p>:</span><span class=w> </span><span class=m>8.8.8.8</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'ZG5zOgogIC0gOC44LjguOAogIC0gOS45LjkuOQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>dns</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=m>8.8.8.8</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=m>9.9.9.9</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=dns_search><a class="text-black dark:text-white no-underline hover:underline" href="index.html#dns_search">dns_search</a></h3><p>Custom DNS search domains. Can be a single value or a list.</p><div class="group relative"><button x-data="{ code: 'ZG5zX3NlYXJjaDogZXhhbXBsZS5jb20=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>dns_search</span><span class=p>:</span><span class=w> </span><span class=l>example.com</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'ZG5zX3NlYXJjaDoKICAtIGRjMS5leGFtcGxlLmNvbQogIC0gZGMyLmV4YW1wbGUuY29t', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>dns_search</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>dc1.example.com</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>dc2.example.com</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=entrypoint><a class="text-black dark:text-white no-underline hover:underline" href="index.html#entrypoint">entrypoint</a></h3><p>Override the default entrypoint.</p><div class="group relative"><button x-data="{ code: 'ZW50cnlwb2ludDogL2NvZGUvZW50cnlwb2ludC5zaA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>entrypoint</span><span class=p>:</span><span class=w> </span><span class=l>/code/entrypoint.sh</span></span></span></code></pre></div></div></div><p>The entrypoint can also be a list, in a manner similar to
<a class=link href="../../../engine/reference/builder/index.html#entrypoint">dockerfile</a>:</p><div class="group relative"><button x-data="{ code: 'ZW50cnlwb2ludDogWyJwaHAiLCAiLWQiLCAibWVtb3J5X2xpbWl0PS0xIiwgInZlbmRvci9iaW4vcGhwdW5pdCJd', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>entrypoint</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;php&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;-d&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;memory_limit=-1&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;vendor/bin/phpunit&#34;</span><span class=p>]</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>Setting <code>entrypoint</code> both overrides any default entrypoint set on the service's
image with the <code>ENTRYPOINT</code> Dockerfile instruction, <em>and</em> clears out any default
command on the image - meaning that if there's a <code>CMD</code> instruction in the
Dockerfile, it is ignored.</p></blockquote><h3 class=scroll-mt-20 id=env_file><a class="text-black dark:text-white no-underline hover:underline" href="index.html#env_file">env_file</a></h3><p>Add environment variables from a file. Can be a single value or a list.</p><p>If you have specified a Compose file with <code>docker-compose -f FILE</code>, paths in
<code>env_file</code> are relative to the directory that file is in.</p><p>Environment variables declared in the
<a class=link href="index.html#environment">environment</a> section
<em>override</em> these values – this holds true even if those values are
empty or undefined.</p><div class="group relative"><button x-data="{ code: 'ZW52X2ZpbGU6IC5lbnY=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>env_file</span><span class=p>:</span><span class=w> </span><span class=l>.env</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'ZW52X2ZpbGU6CiAgLSAuL2NvbW1vbi5lbnYKICAtIC4vYXBwcy93ZWIuZW52CiAgLSAvb3B0L3J1bnRpbWVfb3B0cy5lbnY=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>env_file</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>./common.env</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>./apps/web.env</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>/opt/runtime_opts.env</span></span></span></code></pre></div></div></div><p>Compose expects each line in an env file to be in <code>VAR=VAL</code> format. Lines
beginning with <code>#</code> are treated as comments and are ignored. Blank lines are
also ignored.</p><div class="group relative"><button x-data="{ code: 'IyBTZXQgUmFpbHMvUmFjayBlbnZpcm9ubWVudApSQUNLX0VOVj1kZXZlbG9wbWVudA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>#</span> Set Rails/Rack environment
</span></span><span class=line><span class=cl><span class=go>RACK_ENV=development
</span></span></span></code></pre></div></div></div><p>Compose also recognizes inline comments, like in:</p><div class="group relative"><button x-data="{ code: 'TVlfVkFSID0gdmFsdWUgIyB0aGlzIGlzIGEgY29tbWVudA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-sh data-lang=sh><span class=line><span class=cl><span class=nv>MY_VAR</span> <span class=o>=</span> value <span class=c1># this is a comment</span></span></span></code></pre></div></div></div><p>To avoid interpreting "#" as an inline comment, use the quotation marks:</p><div class="group relative"><button x-data="{ code: 'TVlfVkFSID0gIkFsbCB0aGUgIyBpbnNpZGUgYXJlIHRha2VuIGFzIHBhcnQgb2YgdGhlIHZhbHVlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-sh data-lang=sh><span class=line><span class=cl><span class=nv>MY_VAR</span> <span class=o>=</span> <span class=s2>&#34;All the # inside are taken as part of the value&#34;</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>If your service specifies a
<a class=link href="index.html#build">build</a> option, variables defined in
environment files are <em>not</em> automatically visible during the build. Use
the
<a class=link href="index.html#args">args</a> sub-option of <code>build</code> to define build-time environment
variables.</p></blockquote><p>The value of <code>VAL</code> is used as is and not modified at all. For example if the
value is surrounded by quotes (as is often the case of shell variables), the
quotes are included in the value passed to Compose.</p><p>Keep in mind that <em>the order of files in the list is significant in determining
the value assigned to a variable that shows up more than once</em>. The files in the
list are processed from the top down. For the same variable specified in file
<code>a.env</code> and assigned a different value in file <code>b.env</code>, if <code>b.env</code> is
listed below (after), then the value from <code>b.env</code> stands. For example, given the
following declaration in <code>docker-compose.yml</code>:</p><div class="group relative"><button x-data="{ code: 'c2VydmljZXM6CiAgc29tZS1zZXJ2aWNlOgogICAgZW52X2ZpbGU6CiAgICAgIC0gYS5lbnYKICAgICAgLSBiLmVudg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>some-service</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>env_file</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>a.env</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>b.env</span></span></span></code></pre></div></div></div><p>And the following files:</p><div class="group relative"><button x-data="{ code: 'IyBhLmVudgpWQVI9MQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>#</span> a.env
</span></span><span class=line><span class=cl><span class=go>VAR=1
</span></span></span></code></pre></div></div></div><p>and</p><div class="group relative"><button x-data="{ code: 'IyBiLmVudgpWQVI9aGVsbG8=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>#</span> b.env
</span></span><span class=line><span class=cl><span class=go>VAR=hello
</span></span></span></code></pre></div></div></div><p><code>$VAR</code> is <code>hello</code>.</p><h3 class=scroll-mt-20 id=environment><a class="text-black dark:text-white no-underline hover:underline" href="index.html#environment">environment</a></h3><p>Add environment variables. You can use either an array or a dictionary. Any
boolean values (true, false, yes, no) need to be enclosed in quotes to ensure
they are not converted to True or False by the YML parser.</p><p>Environment variables with only a key are resolved to their values on the
machine Compose is running on, which can be helpful for secret or host-specific values.</p><div class="group relative"><button x-data="{ code: 'ZW52aXJvbm1lbnQ6CiAgUkFDS19FTlY6IGRldmVsb3BtZW50CiAgU0hPVzogJ3RydWUnCiAgU0VTU0lPTl9TRUNSRVQ6', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>environment</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>RACK_ENV</span><span class=p>:</span><span class=w> </span><span class=l>development</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>SHOW</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;true&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>SESSION_SECRET:</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'ZW52aXJvbm1lbnQ6CiAgLSBSQUNLX0VOVj1kZXZlbG9wbWVudAogIC0gU0hPVz10cnVlCiAgLSBTRVNTSU9OX1NFQ1JFVA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>environment</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>RACK_ENV=development</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>SHOW=true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>SESSION_SECRET</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>If your service specifies a
<a class=link href="index.html#build">build</a> option, variables defined in
<code>environment</code> are <em>not</em> automatically visible during the build. Use the
<a class=link href="index.html#args">args</a> sub-option of <code>build</code> to define build-time environment
variables.</p></blockquote><h3 class=scroll-mt-20 id=expose><a class="text-black dark:text-white no-underline hover:underline" href="index.html#expose">expose</a></h3><p>Expose ports without publishing them to the host machine - they'll only be
accessible to linked services. Only the internal port can be specified.</p><div class="group relative"><button x-data="{ code: 'ZXhwb3NlOgogIC0gIjMwMDAiCiAgLSAiODAwMCI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>expose</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;3000&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;8000&#34;</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=external_links><a class="text-black dark:text-white no-underline hover:underline" href="index.html#external_links">external_links</a></h3><p>Link to containers started outside this <code>docker-compose.yml</code> or even outside of
Compose, especially for containers that provide shared or common services.
<code>external_links</code> follow semantics similar to the legacy option <code>links</code> when
specifying both the container name and the link alias (<code>CONTAINER:ALIAS</code>).</p><div class="group relative"><button x-data="{ code: 'ZXh0ZXJuYWxfbGlua3M6CiAgLSByZWRpc18xCiAgLSBwcm9qZWN0X2RiXzE6bXlzcWwKICAtIHByb2plY3RfZGJfMTpwb3N0Z3Jlc3Fs', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>external_links</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>redis_1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>project_db_1:mysql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>project_db_1:postgresql</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>The externally-created containers must be connected to at least one of the same
networks as the service that is linking to them.
<a class=link href="../compose-file-v2/index.html#links">Links</a>
are a legacy option. We recommend using
<a class=link href="index.html#networks">networks</a> instead.</p></blockquote><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>external_links</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a></p></blockquote><h3 class=scroll-mt-20 id=extra_hosts><a class="text-black dark:text-white no-underline hover:underline" href="index.html#extra_hosts">extra_hosts</a></h3><p>Add hostname mappings. Use the same values as the docker client <code>--add-host</code> parameter.</p><div class="group relative"><button x-data="{ code: 'ZXh0cmFfaG9zdHM6CiAgLSAic29tZWhvc3Q6MTYyLjI0Mi4xOTUuODIiCiAgLSAib3RoZXJob3N0OjUwLjMxLjIwOS4yMjki', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>extra_hosts</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;somehost:162.242.195.82&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;otherhost:50.31.209.229&#34;</span></span></span></code></pre></div></div></div><p>An entry with the ip address and hostname is created in <code>/etc/hosts</code> inside containers for this service, e.g:</p><div class="group relative"><button x-data="{ code: 'MTYyLjI0Mi4xOTUuODIgIHNvbWVob3N0CjUwLjMxLjIwOS4yMjkgICBvdGhlcmhvc3Q=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>162.242.195.82  somehost
</span></span></span><span class=line><span class=cl><span class=go>50.31.209.229   otherhost
</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=healthcheck><a class="text-black dark:text-white no-underline hover:underline" href="index.html#healthcheck">healthcheck</a></h3><p>Configure a check that's run to determine whether or not containers for this
service are "healthy". See the docs for the
<a class=link href="../../../engine/reference/builder/index.html#healthcheck">HEALTHCHECK Dockerfile instruction</a>
for details on how healthchecks work.</p><div class="group relative"><button x-data="{ code: 'aGVhbHRoY2hlY2s6CiAgdGVzdDogWyJDTUQiLCAiY3VybCIsICItZiIsICJodHRwOi8vbG9jYWxob3N0Il0KICBpbnRlcnZhbDogMW0zMHMKICB0aW1lb3V0OiAxMHMKICByZXRyaWVzOiAzCiAgc3RhcnRfcGVyaW9kOiAybQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>healthcheck</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>test</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;CMD&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;curl&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;-f&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;http://localhost&#34;</span><span class=p>]</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>interval</span><span class=p>:</span><span class=w> </span><span class=l>1m30s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>timeout</span><span class=p>:</span><span class=w> </span><span class=l>10s</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>retries</span><span class=p>:</span><span class=w> </span><span class=m>3</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>start_period</span><span class=p>:</span><span class=w> </span><span class=l>2m</span></span></span></code></pre></div></div></div><p><code>interval</code>, <code>timeout</code> and <code>start_period</code> are specified as
<a class=link href="index.html#specifying-durations">durations</a>.</p><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format.</p><p>The <code>start_period</code> option was added in file format 3.4.</p></blockquote><p><code>test</code> must be either a string or a list. If it's a list, the first item must be
either <code>NONE</code>, <code>CMD</code> or <code>CMD-SHELL</code>. If it's a string, it's equivalent to
specifying <code>CMD-SHELL</code> followed by that string.</p><div class="group relative"><button x-data="{ code: 'IyBIaXQgdGhlIGxvY2FsIHdlYiBhcHAKdGVzdDogWyJDTUQiLCAiY3VybCIsICItZiIsICJodHRwOi8vbG9jYWxob3N0Il0=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=c># Hit the local web app</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>test</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;CMD&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;curl&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;-f&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;http://localhost&#34;</span><span class=p>]</span></span></span></code></pre></div></div></div><p>As above, but wrapped in <code>/bin/sh</code>. Both forms below are equivalent.</p><div class="group relative"><button x-data="{ code: 'dGVzdDogWyJDTUQtU0hFTEwiLCAiY3VybCAtZiBodHRwOi8vbG9jYWxob3N0IHx8IGV4aXQgMSJd', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>test</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;CMD-SHELL&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;curl -f http://localhost || exit 1&#34;</span><span class=p>]</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'dGVzdDogY3VybCAtZiBodHRwczovL2xvY2FsaG9zdCB8fCBleGl0IDE=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>test</span><span class=p>:</span><span class=w> </span><span class=l>curl -f https://localhost || exit 1</span></span></span></code></pre></div></div></div><p>To disable any default healthcheck set by the image, you can use <code>disable: true</code>.
This is equivalent to specifying <code>test: ["NONE"]</code>.</p><div class="group relative"><button x-data="{ code: 'aGVhbHRoY2hlY2s6CiAgZGlzYWJsZTogdHJ1ZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>healthcheck</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>disable</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=image><a class="text-black dark:text-white no-underline hover:underline" href="index.html#image">image</a></h3><p>Specify the image to start the container from. Can either be a repository/tag or
a partial image ID.</p><div class="group relative"><button x-data="{ code: 'aW1hZ2U6IHJlZGlz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'aW1hZ2U6IHVidW50dToyMi4wNA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>ubuntu:22.04</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'aW1hZ2U6IHR1dHVtL2luZmx1eGRi', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>tutum/influxdb</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'aW1hZ2U6IGV4YW1wbGUtcmVnaXN0cnkuY29tOjQwMDAvcG9zdGdyZXNxbA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>example-registry.com:4000/postgresql</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'aW1hZ2U6IGE0YmM2NWZk', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>a4bc65fd</span></span></span></code></pre></div></div></div><p>If the image does not exist, Compose attempts to pull it, unless you have also
specified
<a class=link href="index.html#build">build</a>, in which case it builds it using the specified
options and tags it with the specified tag.</p><h3 class=scroll-mt-20 id=init><a class="text-black dark:text-white no-underline hover:underline" href="index.html#init">init</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-37">version 3.7</a> file format.</p></blockquote><p>Run an init inside the container that forwards signals and reaps processes.
Set this option to <code>true</code> to enable this feature for the service.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgaW1hZ2U6IGFscGluZTpsYXRlc3QKICAgIGluaXQ6IHRydWU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>alpine:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>init</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><blockquote><p>The default init binary that is used is
<a class=link href=https://github.com/krallin/tini target=_blank rel=noopener>Tini<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>,
and is installed in <code>/usr/libexec/docker-init</code> on the daemon host. You can
configure the daemon to use a custom init binary through the
<a class=link href="https://docs.docker.com/reference/cli/docker/dockerd/#daemon-configuration-file"><code>init-path</code> configuration option</a>.</p></blockquote><h3 class=scroll-mt-20 id=isolation><a class="text-black dark:text-white no-underline hover:underline" href="index.html#isolation">isolation</a></h3><p>Specify a container’s isolation technology. On Linux, the only supported value
is <code>default</code>. On Windows, acceptable values are <code>default</code>, <code>process</code> and
<code>hyperv</code>. Refer to the
<a class=link href="../../../engine/reference/commandline/run/index.html#isolation">Docker Engine docs</a>
for details.</p><h3 class=scroll-mt-20 id=labels-2><a class="text-black dark:text-white no-underline hover:underline" href="index.html#labels-2">labels</a></h3><p>Add metadata to containers using
<a class=link href="../../../engine/userguide/labels-custom-metadata/index.html">Docker labels</a>. You can use either an array or a dictionary.</p><p>It's recommended that you use reverse-DNS notation to prevent your labels from conflicting with those used by other software.</p><div class="group relative"><button x-data="{ code: 'bGFiZWxzOgogIGNvbS5leGFtcGxlLmRlc2NyaXB0aW9uOiAiQWNjb3VudGluZyB3ZWJhcHAiCiAgY29tLmV4YW1wbGUuZGVwYXJ0bWVudDogIkZpbmFuY2UiCiAgY29tLmV4YW1wbGUubGFiZWwtd2l0aC1lbXB0eS12YWx1ZTogIiI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.description</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Accounting webapp&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.department</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Finance&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.label-with-empty-value</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bGFiZWxzOgogIC0gImNvbS5leGFtcGxlLmRlc2NyaXB0aW9uPUFjY291bnRpbmcgd2ViYXBwIgogIC0gImNvbS5leGFtcGxlLmRlcGFydG1lbnQ9RmluYW5jZSIKICAtICJjb20uZXhhbXBsZS5sYWJlbC13aXRoLWVtcHR5LXZhbHVlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.description=Accounting webapp&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.department=Finance&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.label-with-empty-value&#34;</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=links><a class="text-black dark:text-white no-underline hover:underline" href="index.html#links">links</a></h3><blockquote class=warning><p><strong>Warning</strong></p><p>The <code>--link</code> flag is a legacy feature of Docker. It may eventually be removed.
Unless you absolutely need to continue using it, we recommend that you use
<a class=link href="../../networking/index.html">user-defined networks</a>
to facilitate communication between two containers instead of using <code>--link</code>.</p><p>One feature that user-defined networks do not support that you can do with
<code>--link</code> is sharing environmental variables between containers. However, you
can use other mechanisms such as volumes to share environment variables between
containers in a more controlled way.</p></blockquote><p>Link to containers in another service. Either specify both the service name and
a link alias (<code>"SERVICE:ALIAS"</code>), or just the service name.</p><div class="group relative"><button x-data="{ code: 'd2ViOgogIGxpbmtzOgogICAgLSAiZGIiCiAgICAtICJkYjpkYXRhYmFzZSIKICAgIC0gInJlZGlzIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>links</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=s2>&#34;db&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=s2>&#34;db:database&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=s2>&#34;redis&#34;</span></span></span></code></pre></div></div></div><p>Containers for the linked service are reachable at a hostname identical to
the alias, or the service name if no alias was specified.</p><p>Links are not required to enable services to communicate - by default,
any service can reach any other service at that service’s name. (See also, the
<a class=link href="../../networking/index.html#link-containers">Link containers section in Networking in Compose</a>.)</p><p>Links also express dependency between services in the same way as
<a class=link href="index.html#depends_on">depends_on</a>, so they determine the order of service startup.</p><blockquote><p><strong>Note</strong></p><p>If you define both links and
<a class=link href="index.html#networks">networks</a>, services with
links between them must share at least one network in common to
communicate.</p></blockquote><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>links</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a></p></blockquote><h3 class=scroll-mt-20 id=logging><a class="text-black dark:text-white no-underline hover:underline" href="index.html#logging">logging</a></h3><p>Logging configuration for the service.</p><div class="group relative"><button x-data="{ code: 'bG9nZ2luZzoKICBkcml2ZXI6IHN5c2xvZwogIG9wdGlvbnM6CiAgICBzeXNsb2ctYWRkcmVzczogInRjcDovLzE5Mi4xNjguMC40MjoxMjMi', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>logging</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>syslog</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>syslog-address</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;tcp://192.168.0.42:123&#34;</span></span></span></code></pre></div></div></div><p>The <code>driver</code> name specifies a logging driver for the service's
containers, as with the <code>--log-driver</code> option for docker run
(
<a class=link href="../../../config/containers/logging/configure/index.html">documented here</a>).</p><p>The default value is json-file.</p><div class="group relative"><button x-data="{ code: 'ZHJpdmVyOiAianNvbi1maWxlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;json-file&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'ZHJpdmVyOiAic3lzbG9nIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;syslog&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'ZHJpdmVyOiAibm9uZSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;none&#34;</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>Only the <code>json-file</code> and <code>journald</code> drivers make the logs available directly
from <code>docker-compose up</code> and <code>docker-compose logs</code>. Using any other driver
does not print any logs.</p></blockquote><p>Specify logging options for the logging driver with the <code>options</code> key, as with the <code>--log-opt</code> option for <code>docker run</code>.</p><p>Logging options are key-value pairs. An example of <code>syslog</code> options:</p><div class="group relative"><button x-data="{ code: 'ZHJpdmVyOiAic3lzbG9nIgpvcHRpb25zOgogIHN5c2xvZy1hZGRyZXNzOiAidGNwOi8vMTkyLjE2OC4wLjQyOjEyMyI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;syslog&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>syslog-address</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;tcp://192.168.0.42:123&#34;</span></span></span></code></pre></div></div></div><p>The default driver
<a class=link href="../../../config/containers/logging/json-file/index.html">json-file</a>, has options to limit the amount of logs stored. To do this, use a key-value pair for maximum storage size and maximum number of files:</p><div class="group relative"><button x-data="{ code: 'b3B0aW9uczoKICBtYXgtc2l6ZTogIjIwMGsiCiAgbWF4LWZpbGU6ICIxMCI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>max-size</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;200k&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>max-file</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;10&#34;</span></span></span></code></pre></div></div></div><p>The example shown above would store log files until they reach a <code>max-size</code> of
200kB, and then rotate them. The amount of individual log files stored is
specified by the <code>max-file</code> value. As logs grow beyond the max limits, older log
files are removed to allow storage of new logs.</p><p>Here is an example <code>docker-compose.yml</code> file that limits logging storage:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgc29tZS1zZXJ2aWNlOgogICAgaW1hZ2U6IHNvbWUtc2VydmljZQogICAgbG9nZ2luZzoKICAgICAgZHJpdmVyOiAianNvbi1maWxlIgogICAgICBvcHRpb25zOgogICAgICAgIG1heC1zaXplOiAiMjAwayIKICAgICAgICBtYXgtZmlsZTogIjEwIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>some-service</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>some-service</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>logging</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;json-file&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max-size</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;200k&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>max-file</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;10&#34;</span></span></span></code></pre></div></div></div><blockquote><p>Logging options available depend on which logging driver you use</p><p>The above example for controlling log files and sizes uses options
specific to the
<a class=link href="../../../config/containers/logging/json-file/index.html">json-file driver</a>.
These particular options are not available on other logging drivers.
For a full list of supported logging drivers and their options, refer to the
<a class=link href="../../../config/containers/logging/configure/index.html">logging drivers</a> documentation.</p></blockquote><h3 class=scroll-mt-20 id=network_mode><a class="text-black dark:text-white no-underline hover:underline" href="index.html#network_mode">network_mode</a></h3><p>Network mode. Use the same values as the docker client <code>--network</code> parameter, plus
the special form <code>service:[service name]</code>.</p><div class="group relative"><button x-data="{ code: 'bmV0d29ya19tb2RlOiAiYnJpZGdlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>network_mode</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;bridge&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bmV0d29ya19tb2RlOiAiaG9zdCI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>network_mode</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;host&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bmV0d29ya19tb2RlOiAibm9uZSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>network_mode</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;none&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bmV0d29ya19tb2RlOiAic2VydmljZTpbc2VydmljZSBuYW1lXSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>network_mode</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;service:[service name]&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bmV0d29ya19tb2RlOiAiY29udGFpbmVyOltjb250YWluZXIgbmFtZS9pZF0i', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>network_mode</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;container:[container name/id]&#34;</span></span></span></code></pre></div></div></div><blockquote class=important><p><strong>Note</strong></p><ul><li>This option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>.</li><li><code>network_mode: "host"</code> cannot be mixed with
<a class=link href="index.html#links">links</a>.</li></ul></blockquote><h3 class=scroll-mt-20 id=networks><a class="text-black dark:text-white no-underline hover:underline" href="index.html#networks">networks</a></h3><p>Networks to join, referencing entries under the
<a class=link href="index.html#network-configuration-reference">top-level <code>networks</code> key</a>.</p><div class="group relative"><button x-data="{ code: 'c2VydmljZXM6CiAgc29tZS1zZXJ2aWNlOgogICAgbmV0d29ya3M6CiAgICAgLSBzb21lLW5ldHdvcmsKICAgICAtIG90aGVyLW5ldHdvcms=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>some-service</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>     </span>- <span class=l>some-network</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>     </span>- <span class=l>other-network</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=aliases><a class="text-black dark:text-white no-underline hover:underline" href="index.html#aliases">aliases</a></h4><p>Aliases (alternative hostnames) for this service on the network. Other containers on the same network can use either the service name or this alias to connect to one of the service's containers.</p><p>Since <code>aliases</code> is network-scoped, the same service can have different aliases on different networks.</p><blockquote><p><strong>Note</strong></p><p>A network-wide alias can be shared by multiple containers, and even by multiple
services. If it is, then exactly which container the name resolves to is not
guaranteed.</p></blockquote><p>The general format is shown here.</p><div class="group relative"><button x-data="{ code: 'c2VydmljZXM6CiAgc29tZS1zZXJ2aWNlOgogICAgbmV0d29ya3M6CiAgICAgIHNvbWUtbmV0d29yazoKICAgICAgICBhbGlhc2VzOgogICAgICAgICAgLSBhbGlhczEKICAgICAgICAgIC0gYWxpYXMzCiAgICAgIG90aGVyLW5ldHdvcms6CiAgICAgICAgYWxpYXNlczoKICAgICAgICAgIC0gYWxpYXMy', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>some-service</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>some-network</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>aliases</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=l>alias1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=l>alias3</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>other-network</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>aliases</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=l>alias2</span></span></span></code></pre></div></div></div><p>In the example below, three services are provided (<code>web</code>, <code>worker</code>, and <code>db</code>),
along with two networks (<code>new</code> and <code>legacy</code>). The <code>db</code> service is reachable at
the hostname <code>db</code> or <code>database</code> on the <code>new</code> network, and at <code>db</code> or <code>mysql</code> on
the <code>legacy</code> network.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKCnNlcnZpY2VzOgogIHdlYjoKICAgIGltYWdlOiAibmdpbng6YWxwaW5lIgogICAgbmV0d29ya3M6CiAgICAgIC0gbmV3CgogIHdvcmtlcjoKICAgIGltYWdlOiAibXktd29ya2VyLWltYWdlOmxhdGVzdCIKICAgIG5ldHdvcmtzOgogICAgICAtIGxlZ2FjeQoKICBkYjoKICAgIGltYWdlOiBteXNxbAogICAgbmV0d29ya3M6CiAgICAgIG5ldzoKICAgICAgICBhbGlhc2VzOgogICAgICAgICAgLSBkYXRhYmFzZQogICAgICBsZWdhY3k6CiAgICAgICAgYWxpYXNlczoKICAgICAgICAgIC0gbXlzcWwKCm5ldHdvcmtzOgogIG5ldzoKICBsZWdhY3k6', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;nginx:alpine&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>new</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>worker</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;my-worker-image:latest&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>legacy</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>mysql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>new</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>aliases</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=l>database</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>legacy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>aliases</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span>- <span class=l>mysql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>new</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>legacy:</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=ipv4_address-ipv6_address><a class="text-black dark:text-white no-underline hover:underline" href="index.html#ipv4_address-ipv6_address">ipv4_address, ipv6_address</a></h4><p>Specify a static IP address for containers for this service when joining the network.</p><p>The corresponding network configuration in the
<a class=link href="index.html#network-configuration-reference">top-level networks section</a> must have an
<code>ipam</code> block with subnet configurations covering each static address.</p><p>If you'd like to use IPv6, you must first ensure that the Docker daemon is configured to support IPv6. See
<a class=link href="../../../config/daemon/ipv6/index.html">Enable IPv6</a> for detailed instructions. You can then access IPv6 addressing in a version 3.x Compose file by editing the <code>/etc/docker/daemon.json</code> to contain:
<code>{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64"}</code></p><p>Then, reload the docker daemon and edit docker-compose.yml to contain the following under the service:</p><div class="group relative"><button x-data="{ code: 'ICAgIHN5c2N0bHM6CiAgICAgIC0gbmV0LmlwdjYuY29uZi5hbGwuZGlzYWJsZV9pcHY2PTA=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=w>    </span><span class=nt>sysctls</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>net.ipv6.conf.all.disable_ipv6=0</span></span></span></code></pre></div></div></div><blockquote><p>The
<a class=link href="../compose-file-v2/index.html#enable_ipv6"><code>enable_ipv6</code></a>
option is only available in a
<a class=link href="../compose-file-v2/index.html#ipv4_address-ipv6_address">version 2.x Compose file</a>.
<em>IPv6 options do not currently work in swarm mode</em>.</p></blockquote><p>An example:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKCnNlcnZpY2VzOgogIGFwcDoKICAgIGltYWdlOiBuZ2lueDphbHBpbmUKICAgIG5ldHdvcmtzOgogICAgICBhcHBfbmV0OgogICAgICAgIGlwdjRfYWRkcmVzczogMTcyLjE2LjIzOC4xMAogICAgICAgIGlwdjZfYWRkcmVzczogMjAwMTozOTg0OjM5ODk6OjEwCgpuZXR3b3JrczoKICBhcHBfbmV0OgogICAgaXBhbToKICAgICAgZHJpdmVyOiBkZWZhdWx0CiAgICAgIGNvbmZpZzoKICAgICAgICAtIHN1Ym5ldDogIjE3Mi4xNi4yMzguMC8yNCIKICAgICAgICAtIHN1Ym5ldDogIjIwMDE6Mzk4NDozOTg5OjovNjQi', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>app</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>nginx:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>app_net</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>ipv4_address</span><span class=p>:</span><span class=w> </span><span class=m>172.16.238.10</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>ipv6_address</span><span class=p>:</span><span class=w> </span><span class=m>2001</span><span class=p>:</span><span class=m>3984</span><span class=p>:</span><span class=m>3989</span><span class=p>::</span><span class=m>10</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>app_net</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ipam</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>default</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span>- <span class=nt>subnet</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;172.16.238.0/24&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span>- <span class=nt>subnet</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;2001:3984:3989::/64&#34;</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=pid><a class="text-black dark:text-white no-underline hover:underline" href="index.html#pid">pid</a></h3><div class="group relative"><button x-data="{ code: 'cGlkOiAiaG9zdCI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>pid</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;host&#34;</span></span></span></code></pre></div></div></div><p>Sets the PID mode to the host PID mode. This turns on sharing between
container and the host operating system the PID address space. Containers
launched with this flag can access and manipulate other
containers in the bare-metal machine's namespace and vice versa.</p><h3 class=scroll-mt-20 id=ports><a class="text-black dark:text-white no-underline hover:underline" href="index.html#ports">ports</a></h3><p>Expose ports.</p><blockquote><p><strong>Note</strong></p><p>Port mapping is incompatible with <code>network_mode: host</code></p></blockquote><blockquote><p><strong>Note</strong></p><p><code>docker-compose run</code> ignores <code>ports</code> unless you include <code>--service-ports</code>.</p></blockquote><h4 class=scroll-mt-20 id=short-syntax-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#short-syntax-1">Short syntax</a></h4><p>There are three options:</p><ul><li>Specify both ports (<code>HOST:CONTAINER</code>)</li><li>Specify just the container port (an ephemeral host port is chosen for the host port).</li><li>Specify the host IP address to bind to AND both ports (the default is 0.0.0.0, meaning all interfaces): (<code>IPADDR:HOSTPORT:CONTAINERPORT</code>). If HOSTPORT is empty (for example <code>127.0.0.1::80</code>), an ephemeral port is chosen to bind to on the host.</li></ul><blockquote><p><strong>Note</strong></p><p>When mapping ports in the <code>HOST:CONTAINER</code> format, you may experience
erroneous results when using a container port lower than 60, because YAML
parses numbers in the format <code>xx:yy</code> as a base-60 value. For this reason,
we recommend always explicitly specifying your port mappings as strings.</p></blockquote><div class="group relative"><button x-data="{ code: 'cG9ydHM6CiAgLSAiMzAwMCIKICAtICIzMDAwLTMwMDUiCiAgLSAiODAwMDo4MDAwIgogIC0gIjkwOTAtOTA5MTo4MDgwLTgwODEiCiAgLSAiNDkxMDA6MjIiCiAgLSAiMTI3LjAuMC4xOjgwMDE6ODAwMSIKICAtICIxMjcuMC4wLjE6NTAwMC01MDEwOjUwMDAtNTAxMCIKICAtICIxMjcuMC4wLjE6OjUwMDAiCiAgLSAiNjA2MDo2MDYwL3VkcCIKICAtICIxMjQwMC0xMjUwMDoxMjQwIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;3000&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;3000-3005&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;8000:8000&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;9090-9091:8080-8081&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;49100:22&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;127.0.0.1:8001:8001&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;127.0.0.1:5000-5010:5000-5010&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;127.0.0.1::5000&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;6060:6060/udp&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;12400-12500:1240&#34;</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=long-syntax-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#long-syntax-1">Long syntax</a></h4><p>The long form syntax allows the configuration of additional fields that can't be
expressed in the short form.</p><ul><li><code>target</code>: the port inside the container</li><li><code>published</code>: the publicly exposed port</li><li><code>protocol</code>: the port protocol (<code>tcp</code> or <code>udp</code>)</li><li><code>mode</code>: <code>host</code> for publishing a host port on each node, or <code>ingress</code> for a swarm
mode port to be load balanced.</li></ul><div class="group relative"><button x-data="{ code: 'cG9ydHM6CiAgLSB0YXJnZXQ6IDgwCiAgICBwdWJsaXNoZWQ6IDgwODAKICAgIHByb3RvY29sOiB0Y3AKICAgIG1vZGU6IGhvc3Q=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=m>80</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>published</span><span class=p>:</span><span class=w> </span><span class=m>8080</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>protocol</span><span class=p>:</span><span class=w> </span><span class=l>tcp</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=l>host</span></span></span></code></pre></div></div></div><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-32">version 3.2</a> file format.</p><p>The long syntax is new in the v3.2 file format.</p></blockquote><h3 class=scroll-mt-20 id=profiles><a class="text-black dark:text-white no-underline hover:underline" href="index.html#profiles">profiles</a></h3><div class="group relative"><button x-data="{ code: 'cHJvZmlsZXM6IFsiZnJvbnRlbmQiLCAiZGVidWciXQpwcm9maWxlczoKICAtIGZyb250ZW5kCiAgLSBkZWJ1Zw==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>profiles</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;frontend&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;debug&#34;</span><span class=p>]</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>profiles</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>frontend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>debug</span></span></span></code></pre></div></div></div><p><code>profiles</code> defines a list of named profiles for the service to be enabled under.
When not set, the service is <em>always</em> enabled. For the services that make up
your core application you should omit <code>profiles</code> so they will always be started.</p><p>Valid profile names follow the regex format <code>[a-zA-Z0-9][a-zA-Z0-9_.-]+</code>.</p><p>See also
<a class=link href="../../profiles/index.html"><em>Using profiles with Compose</em></a> to learn more about
profiles.</p><h3 class=scroll-mt-20 id=restart><a class="text-black dark:text-white no-underline hover:underline" href="index.html#restart">restart</a></h3><p><code>no</code> is the default
<a class=link href="../../../config/containers/start-containers-automatically/index.html#use-a-restart-policy">restart policy</a>, and it does not restart a container under
any circumstance. When <code>always</code> is specified, the container always restarts. The
<code>on-failure</code> policy restarts a container if the exit code indicates an
on-failure error. <code>unless-stopped</code> always restarts a container, except when the
container is stopped (manually or otherwise).</p><pre><code>restart: &quot;no&quot;
restart: always
restart: on-failure
restart: unless-stopped
</code></pre><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>restart</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>.</p></blockquote><h3 class=scroll-mt-20 id=secrets><a class="text-black dark:text-white no-underline hover:underline" href="index.html#secrets">secrets</a></h3><p>Grant access to secrets on a per-service basis using the per-service <code>secrets</code>
configuration. Two different syntax variants are supported.</p><blockquote class=important><p>Note when using docker stack deploy</p><p>The secret must already exist or be
<a class=link href="index.html#secrets-configuration-reference">defined in the top-level <code>secrets</code> configuration</a>
of the compose file, or stack deployment fails.</p></blockquote><p>For more information on secrets, see
<a class=link href="../../../engine/swarm/secrets/index.html">secrets</a>.</p><h4 class=scroll-mt-20 id=short-syntax-2><a class="text-black dark:text-white no-underline hover:underline" href="index.html#short-syntax-2">Short syntax</a></h4><p>The short syntax variant only specifies the secret name. This grants the
container access to the secret and mounts it at <code>/run/secrets/&lt;secret_name></code>
within the container. The source name and destination mountpoint are both set
to the secret name.</p><p>The following example uses the short syntax to grant the <code>redis</code> service
access to the <code>my_secret</code> and <code>my_other_secret</code> secrets. The value of
<code>my_secret</code> is set to the contents of the file <code>./my_secret.txt</code>, and
<code>my_other_secret</code> is defined as an external resource, which means that it has
already been defined in Docker, either by running the <code>docker secret create</code>
command or by another stack deployment. If the external secret does not exist,
the stack deployment fails with a <code>secret not found</code> error.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6bGF0ZXN0CiAgICBkZXBsb3k6CiAgICAgIHJlcGxpY2FzOiAxCiAgICBzZWNyZXRzOgogICAgICAtIG15X3NlY3JldAogICAgICAtIG15X290aGVyX3NlY3JldApzZWNyZXRzOgogIG15X3NlY3JldDoKICAgIGZpbGU6IC4vbXlfc2VjcmV0LnR4dAogIG15X290aGVyX3NlY3JldDoKICAgIGV4dGVybmFsOiB0cnVl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>secrets</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>my_secret</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>my_other_secret</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>secrets</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./my_secret.txt</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_other_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=long-syntax-2><a class="text-black dark:text-white no-underline hover:underline" href="index.html#long-syntax-2">Long syntax</a></h4><p>The long syntax provides more granularity in how the secret is created within
the service's task containers.</p><ul><li><code>source</code>: The identifier of the secret as it is defined in this configuration.</li><li><code>target</code>: The name of the file to be mounted in <code>/run/secrets/</code> in the
service's task containers. Defaults to <code>source</code> if not specified.</li><li><code>uid</code> and <code>gid</code>: The numeric UID or GID that owns the file within
<code>/run/secrets/</code> in the service's task containers. Both default to <code>0</code> if not
specified.</li><li><code>mode</code>: The permissions for the file to be mounted in <code>/run/secrets/</code>
in the service's task containers, in octal notation. For instance, <code>0444</code>
represents world-readable. The default in Docker 1.13.1 is <code>0000</code>, but it is
<code>0444</code> in newer versions. Secrets cannot be writable because they are mounted
in a temporary filesystem, so if you set the writable bit, it is ignored. The
executable bit can be set. If you aren't familiar with UNIX file permission
modes, you may find this
<a class=link href=http://permissions-calculator.org/ target=_blank rel=noopener>permissions calculator<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
useful.</li></ul><p>The following example sets name of the <code>my_secret</code> to <code>redis_secret</code> within the
container, sets the mode to <code>0440</code> (group-readable) and sets the user and group
to <code>103</code>. The <code>redis</code> service does not have access to the <code>my_other_secret</code>
secret.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgcmVkaXM6CiAgICBpbWFnZTogcmVkaXM6bGF0ZXN0CiAgICBkZXBsb3k6CiAgICAgIHJlcGxpY2FzOiAxCiAgICBzZWNyZXRzOgogICAgICAtIHNvdXJjZTogbXlfc2VjcmV0CiAgICAgICAgdGFyZ2V0OiByZWRpc19zZWNyZXQKICAgICAgICB1aWQ6ICcxMDMnCiAgICAgICAgZ2lkOiAnMTAzJwogICAgICAgIG1vZGU6IDA0NDAKc2VjcmV0czoKICBteV9zZWNyZXQ6CiAgICBmaWxlOiAuL215X3NlY3JldC50eHQKICBteV9vdGhlcl9zZWNyZXQ6CiAgICBleHRlcm5hbDogdHJ1ZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>redis</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>redis:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>replicas</span><span class=p>:</span><span class=w> </span><span class=m>1</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>secrets</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=nt>source</span><span class=p>:</span><span class=w> </span><span class=l>my_secret</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>redis_secret</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>uid</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;103&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>gid</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;103&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>mode</span><span class=p>:</span><span class=w> </span><span class=m>0440</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>secrets</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./my_secret.txt</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_other_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><p>You can grant a service access to multiple secrets and you can mix long and
short syntax. Defining a secret does not imply granting a service access to it.</p><h3 class=scroll-mt-20 id=security_opt><a class="text-black dark:text-white no-underline hover:underline" href="index.html#security_opt">security_opt</a></h3><p>Override the default labeling scheme for each container.</p><div class="group relative"><button x-data="{ code: 'c2VjdXJpdHlfb3B0OgogIC0gbGFiZWw6dXNlcjpVU0VSCiAgLSBsYWJlbDpyb2xlOlJPTEU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>security_opt</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>label:user:USER</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>label:role:ROLE</span></span></span></code></pre></div></div></div><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>security_opt</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>.</p></blockquote><h3 class=scroll-mt-20 id=stop_grace_period><a class="text-black dark:text-white no-underline hover:underline" href="index.html#stop_grace_period">stop_grace_period</a></h3><p>Specify how long to wait when attempting to stop a container if it doesn't
handle SIGTERM (or whatever stop signal has been specified with
<a class=link href="index.html#stop_signal"><code>stop_signal</code></a>), before sending SIGKILL. Specified
as a
<a class=link href="index.html#specifying-durations">duration</a>.</p><div class="group relative"><button x-data="{ code: 'c3RvcF9ncmFjZV9wZXJpb2Q6IDFz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>stop_grace_period</span><span class=p>:</span><span class=w> </span><span class=l>1s</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'c3RvcF9ncmFjZV9wZXJpb2Q6IDFtMzBz', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>stop_grace_period</span><span class=p>:</span><span class=w> </span><span class=l>1m30s</span></span></span></code></pre></div></div></div><p>By default, <code>stop</code> waits 10 seconds for the container to exit before sending
SIGKILL.</p><h3 class=scroll-mt-20 id=stop_signal><a class="text-black dark:text-white no-underline hover:underline" href="index.html#stop_signal">stop_signal</a></h3><p>Sets an alternative signal to stop the container. By default <code>stop</code> uses
SIGTERM. Setting an alternative signal using <code>stop_signal</code> causes
<code>stop</code> to send that signal instead.</p><div class="group relative"><button x-data="{ code: 'c3RvcF9zaWduYWw6IFNJR1VTUjE=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>stop_signal</span><span class=p>:</span><span class=w> </span><span class=l>SIGUSR1</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=sysctls><a class="text-black dark:text-white no-underline hover:underline" href="index.html#sysctls">sysctls</a></h3><p>Kernel parameters to set in the container. You can use either an array or a
dictionary.</p><div class="group relative"><button x-data="{ code: 'c3lzY3RsczoKICBuZXQuY29yZS5zb21heGNvbm46IDEwMjQKICBuZXQuaXB2NC50Y3Bfc3luY29va2llczogMA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>sysctls</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>net.core.somaxconn</span><span class=p>:</span><span class=w> </span><span class=m>1024</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>net.ipv4.tcp_syncookies</span><span class=p>:</span><span class=w> </span><span class=m>0</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'c3lzY3RsczoKICAtIG5ldC5jb3JlLnNvbWF4Y29ubj0xMDI0CiAgLSBuZXQuaXB2NC50Y3Bfc3luY29va2llcz0w', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>sysctls</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>net.core.somaxconn=1024</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>net.ipv4.tcp_syncookies=0</span></span></span></code></pre></div></div></div><p>You can only use sysctls that are namespaced in the kernel. Docker does not
support changing sysctls inside a container that also modify the host system.
For an overview of supported sysctls, refer to
<a class=link href="../../../engine/reference/commandline/run/index.html#sysctl">configure namespaced kernel parameters (sysctls) at runtime</a>.</p><blockquote><p>Note when using docker stack deploy</p><p>This option requires Docker Engine 19.03 or up when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>.</p></blockquote><h3 class=scroll-mt-20 id=tmpfs><a class="text-black dark:text-white no-underline hover:underline" href="index.html#tmpfs">tmpfs</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-36">version 3.6</a> file format.</p></blockquote><p>Mount a temporary file system inside the container. Can be a single value or a list.</p><div class="group relative"><button x-data="{ code: 'dG1wZnM6IC9ydW4=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>tmpfs</span><span class=p>:</span><span class=w> </span><span class=l>/run</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'dG1wZnM6CiAgLSAvcnVuCiAgLSAvdG1w', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>tmpfs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>/run</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>/tmp</span></span></span></code></pre></div></div></div><blockquote><p>Note when using docker stack deploy</p><p>This option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>
with a (version 3-3.5) Compose file.</p></blockquote><p>Mount a temporary file system inside the container. Size parameter specifies the size
of the tmpfs mount in bytes. Unlimited by default.</p><div class="group relative"><button x-data="{ code: 'LSB0eXBlOiB0bXBmcwogIHRhcmdldDogL2FwcAogIHRtcGZzOgogICAgc2l6ZTogMTAwMA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl>- <span class=nt>type</span><span class=p>:</span><span class=w> </span><span class=l>tmpfs</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>/app</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>tmpfs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>size</span><span class=p>:</span><span class=w> </span><span class=m>1000</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=ulimits><a class="text-black dark:text-white no-underline hover:underline" href="index.html#ulimits">ulimits</a></h3><p>Override the default ulimits for a container. You can either specify a single
limit as an integer or soft/hard limits as a mapping.</p><div class="group relative"><button x-data="{ code: 'dWxpbWl0czoKICBucHJvYzogNjU1MzUKICBub2ZpbGU6CiAgICBzb2Z0OiAyMDAwMAogICAgaGFyZDogNDAwMDA=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>ulimits</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>nproc</span><span class=p>:</span><span class=w> </span><span class=m>65535</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>nofile</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>soft</span><span class=p>:</span><span class=w> </span><span class=m>20000</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>hard</span><span class=p>:</span><span class=w> </span><span class=m>40000</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=userns_mode><a class="text-black dark:text-white no-underline hover:underline" href="index.html#userns_mode">userns_mode</a></h3><div class="group relative"><button x-data="{ code: 'dXNlcm5zX21vZGU6ICJob3N0Ig==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>userns_mode</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;host&#34;</span></span></span></code></pre></div></div></div><p>Disables the user namespace for this service, if Docker daemon is configured with user namespaces.
See
<a class=link href="../../../engine/security/userns-remap/index.html#disable-namespace-remapping-for-a-container">dockerd</a> for
more information.</p><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>userns_mode</code> option is ignored when
<a class=link href="../../../reference/cli/docker/stack/deploy/index.html">deploying a stack in swarm mode</a>.</p></blockquote><h3 class=scroll-mt-20 id=volumes><a class="text-black dark:text-white no-underline hover:underline" href="index.html#volumes">volumes</a></h3><p>Mount host paths or named volumes, specified as sub-options to a service.</p><p>You can mount a host path as part of a definition for a single service, and
there is no need to define it in the top level <code>volumes</code> key.</p><p>But, if you want to reuse a volume across multiple services, then define a named
volume in the
<a class=link href="index.html#volume-configuration-reference">top-level <code>volumes</code> key</a>. Use
named volumes with
<a class=link href="index.html#volumes-for-services-swarms-and-stack-files">services, swarms, and stack
files</a>.</p><blockquote><p>Changed in
<a class=link href="../compose-versioning/index.html#version-3">version 3</a> file format.</p><p>The top-level
<a class=link href="index.html#volume-configuration-reference">volumes</a> key defines
a named volume and references it from each service's <code>volumes</code> list. This
replaces <code>volumes_from</code> in earlier versions of the Compose file format.</p></blockquote><p>This example shows a named volume (<code>mydata</code>) being used by the <code>web</code> service,
and a bind mount defined for a single service (first path under <code>db</code> service
<code>volumes</code>). The <code>db</code> service also uses a named volume called <code>dbdata</code> (second
path under <code>db</code> service <code>volumes</code>), but defines it using the old string format
for mounting a named volume. Named volumes must be listed under the top-level
<code>volumes</code> key, as shown.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgaW1hZ2U6IG5naW54OmFscGluZQogICAgdm9sdW1lczoKICAgICAgLSB0eXBlOiB2b2x1bWUKICAgICAgICBzb3VyY2U6IG15ZGF0YQogICAgICAgIHRhcmdldDogL2RhdGEKICAgICAgICB2b2x1bWU6CiAgICAgICAgICBub2NvcHk6IHRydWUKICAgICAgLSB0eXBlOiBiaW5kCiAgICAgICAgc291cmNlOiAuL3N0YXRpYwogICAgICAgIHRhcmdldDogL29wdC9hcHAvc3RhdGljCgogIGRiOgogICAgaW1hZ2U6IHBvc3RncmVzOmxhdGVzdAogICAgdm9sdW1lczoKICAgICAgLSAiL3Zhci9ydW4vcG9zdGdyZXMvcG9zdGdyZXMuc29jazovdmFyL3J1bi9wb3N0Z3Jlcy9wb3N0Z3Jlcy5zb2NrIgogICAgICAtICJkYmRhdGE6L3Zhci9saWIvcG9zdGdyZXNxbC9kYXRhIgoKdm9sdW1lczoKICBteWRhdGE6CiAgZGJkYXRhOg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>nginx:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=nt>type</span><span class=p>:</span><span class=w> </span><span class=l>volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>source</span><span class=p>:</span><span class=w> </span><span class=l>mydata</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>volume</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span><span class=nt>nocopy</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=nt>type</span><span class=p>:</span><span class=w> </span><span class=l>bind</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>source</span><span class=p>:</span><span class=w> </span><span class=l>./static</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>/opt/app/static</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>postgres:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;/var/run/postgres/postgres.sock:/var/run/postgres/postgres.sock&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;dbdata:/var/lib/postgresql/data&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>mydata</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>dbdata:</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>For general information on volumes, refer to the
<a class=link href="../../../storage/volumes/index.html">use volumes</a>
and
<a class=link href="../../../engine/extend/plugins_volume/index.html">volume plugins</a> sections in the documentation.</p></blockquote><h4 class=scroll-mt-20 id=short-syntax-3><a class="text-black dark:text-white no-underline hover:underline" href="index.html#short-syntax-3">Short syntax</a></h4><p>The short syntax uses the generic <code>[SOURCE:]TARGET[:MODE]</code> format, where
<code>SOURCE</code> can be either a host path or volume name. <code>TARGET</code> is the container
path where the volume is mounted. Standard modes are <code>ro</code> for read-only
and <code>rw</code> for read-write (default).</p><p>You can mount a relative path on the host, which expands relative to
the directory of the Compose configuration file being used. Relative paths
should always begin with <code>.</code> or <code>..</code>.</p><div class="group relative"><button x-data="{ code: 'dm9sdW1lczoKICAjIEp1c3Qgc3BlY2lmeSBhIHBhdGggYW5kIGxldCB0aGUgRW5naW5lIGNyZWF0ZSBhIHZvbHVtZQogIC0gL3Zhci9saWIvbXlzcWwKCiAgIyBTcGVjaWZ5IGFuIGFic29sdXRlIHBhdGggbWFwcGluZwogIC0gL29wdC9kYXRhOi92YXIvbGliL215c3FsCgogICMgUGF0aCBvbiB0aGUgaG9zdCwgcmVsYXRpdmUgdG8gdGhlIENvbXBvc2UgZmlsZQogIC0gLi9jYWNoZTovdG1wL2NhY2hlCgogICMgVXNlci1yZWxhdGl2ZSBwYXRoCiAgLSB+L2NvbmZpZ3M6L2V0Yy9jb25maWdzLzpybwoKICAjIE5hbWVkIHZvbHVtZQogIC0gZGF0YXZvbHVtZTovdmFyL2xpYi9teXNxbA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=c># Just specify a path and let the Engine create a volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>/var/lib/mysql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=c># Specify an absolute path mapping</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>/opt/data:/var/lib/mysql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=c># Path on the host, relative to the Compose file</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>./cache:/tmp/cache</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=c># User-relative path</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>~/configs:/etc/configs/:ro</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=c># Named volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=l>datavolume:/var/lib/mysql</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=long-syntax-3><a class="text-black dark:text-white no-underline hover:underline" href="index.html#long-syntax-3">Long syntax</a></h4><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-32">version 3.2</a> file format.</p></blockquote><p>The long form syntax allows the configuration of additional fields that can't be
expressed in the short form.</p><ul><li><code>type</code>: the mount type <code>volume</code>, <code>bind</code>, <code>tmpfs</code> or <code>npipe</code></li><li><code>source</code>: the source of the mount, a path on the host for a bind mount, or the
name of a volume defined in the
<a class=link href="index.html#volume-configuration-reference">top-level <code>volumes</code> key</a>. Not applicable for a tmpfs mount.</li><li><code>target</code>: the path in the container where the volume is mounted</li><li><code>read_only</code>: flag to set the volume as read-only</li><li><code>bind</code>: configure additional bind options<ul><li><code>propagation</code>: the propagation mode used for the bind</li></ul></li><li><code>volume</code>: configure additional volume options<ul><li><code>nocopy</code>: flag to disable copying of data from a container when a volume is
created</li></ul></li><li><code>tmpfs</code>: configure additional tmpfs options<ul><li><code>size</code>: the size for the tmpfs mount in bytes</li></ul></li></ul><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgaW1hZ2U6IG5naW54OmFscGluZQogICAgcG9ydHM6CiAgICAgIC0gIjgwOjgwIgogICAgdm9sdW1lczoKICAgICAgLSB0eXBlOiB2b2x1bWUKICAgICAgICBzb3VyY2U6IG15ZGF0YQogICAgICAgIHRhcmdldDogL2RhdGEKICAgICAgICB2b2x1bWU6CiAgICAgICAgICBub2NvcHk6IHRydWUKICAgICAgLSB0eXBlOiBiaW5kCiAgICAgICAgc291cmNlOiAuL3N0YXRpYwogICAgICAgIHRhcmdldDogL29wdC9hcHAvc3RhdGljCgpuZXR3b3JrczoKICB3ZWJuZXQ6Cgp2b2x1bWVzOgogIG15ZGF0YTo=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>nginx:alpine</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>ports</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=s2>&#34;80:80&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=nt>type</span><span class=p>:</span><span class=w> </span><span class=l>volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>source</span><span class=p>:</span><span class=w> </span><span class=l>mydata</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>volume</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>          </span><span class=nt>nocopy</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=nt>type</span><span class=p>:</span><span class=w> </span><span class=l>bind</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>source</span><span class=p>:</span><span class=w> </span><span class=l>./static</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>target</span><span class=p>:</span><span class=w> </span><span class=l>/opt/app/static</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>webnet</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>mydata:</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>When creating bind mounts, using the long syntax requires the
referenced folder to be created beforehand. Using the short syntax
creates the folder on the fly if it doesn't exist.
See the
<a class=link href="../../../storage/bind-mounts/index.html#differences-between--v-and---mount-behavior">bind mounts documentation</a>
for more information.</p></blockquote><h4 class=scroll-mt-20 id=volumes-for-services-swarms-and-stack-files><a class="text-black dark:text-white no-underline hover:underline" href="index.html#volumes-for-services-swarms-and-stack-files">Volumes for services, swarms, and stack files</a></h4><blockquote><p>Note when using docker stack deploy</p><p>When working with services, swarms, and <code>docker-stack.yml</code> files, keep in mind
that the tasks (containers) backing a service can be deployed on any node in a
swarm, and this may be a different node each time the service is updated.</p></blockquote><p>In the absence of having named volumes with specified sources, Docker creates an
anonymous volume for each task backing a service. Anonymous volumes do not
persist after the associated containers are removed.</p><p>If you want your data to persist, use a named volume and a volume driver that
is multi-host aware, so that the data is accessible from any node. Or, set
constraints on the service so that its tasks are deployed on a node that has the
volume present.</p><p>As an example, the <code>docker-stack.yml</code> file for the
<a class=link href=https://github.com/docker/labs/blob/master/beginner/chapters/votingapp.md target=_blank rel=noopener>votingapp sample in Docker Labs<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
defines a service called <code>db</code> that runs a <code>postgres</code> database. It is configured
as a named volume to persist the data on the swarm, <em>and</em> is constrained to run
only on <code>manager</code> nodes. Here is the relevant snip-it from that file:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgZGI6CiAgICBpbWFnZTogcG9zdGdyZXM6OS40CiAgICB2b2x1bWVzOgogICAgICAtIGRiLWRhdGE6L3Zhci9saWIvcG9zdGdyZXNxbC9kYXRhCiAgICBuZXR3b3JrczoKICAgICAgLSBiYWNrZW5kCiAgICBkZXBsb3k6CiAgICAgIHBsYWNlbWVudDoKICAgICAgICBjb25zdHJhaW50czogW25vZGUucm9sZSA9PSBtYW5hZ2VyXQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>postgres:9.4</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>db-data:/var/lib/postgresql/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>backend</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>deploy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>placement</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>        </span><span class=nt>constraints</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=l>node.role == manager]</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir><a class="text-black dark:text-white no-underline hover:underline" href="index.html#domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir">domainname, hostname, ipc, mac_address, privileged, read_only, shm_size, stdin_open, tty, user, working_dir</a></h3><p>Each of these is a single value, analogous to its
<a class=link href="../../../engine/reference/commandline/run/index.html">docker run</a> counterpart. Note that <code>mac_address</code> is a legacy option.</p><div class="group relative"><button x-data="{ code: 'dXNlcjogcG9zdGdyZXNxbAp3b3JraW5nX2RpcjogL2NvZGUKCmRvbWFpbm5hbWU6IGZvby5jb20KaG9zdG5hbWU6IGZvbwppcGM6IGhvc3QKbWFjX2FkZHJlc3M6IDAyOjQyOmFjOjExOjY1OjQzCgpwcml2aWxlZ2VkOiB0cnVlCgoKcmVhZF9vbmx5OiB0cnVlCnNobV9zaXplOiA2NE0Kc3RkaW5fb3BlbjogdHJ1ZQp0dHk6IHRydWU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>user</span><span class=p>:</span><span class=w> </span><span class=l>postgresql</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>working_dir</span><span class=p>:</span><span class=w> </span><span class=l>/code</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>domainname</span><span class=p>:</span><span class=w> </span><span class=l>foo.com</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>hostname</span><span class=p>:</span><span class=w> </span><span class=l>foo</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>ipc</span><span class=p>:</span><span class=w> </span><span class=l>host</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>mac_address</span><span class=p>:</span><span class=w> </span><span class=m>02</span><span class=p>:</span><span class=m>42</span><span class=p>:</span><span class=l>ac:11:65:43</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>privileged</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>read_only</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>shm_size</span><span class=p>:</span><span class=w> </span><span class=l>64M</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>stdin_open</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>tty</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><h2 class=scroll-mt-20 id=specifying-durations><a class="text-black dark:text-white no-underline hover:underline" href="index.html#specifying-durations">Specifying durations</a></h2><p>Some configuration options, such as the <code>interval</code> and <code>timeout</code> sub-options for
<a class=link href="index.html#healthcheck"><code>check</code></a>, accept a duration as a string in a
format that looks like this:</p><pre><code>2.5s
10s
1m30s
2h32m
5h34m56s
</code></pre><p>The supported units are <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code> and <code>h</code>.</p><h2 class=scroll-mt-20 id=specifying-byte-values><a class="text-black dark:text-white no-underline hover:underline" href="index.html#specifying-byte-values">Specifying byte values</a></h2><p>Some configuration options, such as the <code>shm_size</code> sub-option for
<a class=link href="index.html#build"><code>build</code></a>, accept a byte value as a string in a format
that looks like this:</p><pre><code>2b
1024kb
2048k
300m
1gb
</code></pre><p>The supported units are <code>b</code>, <code>k</code>, <code>m</code> and <code>g</code>, and their alternative notation <code>kb</code>,
<code>mb</code> and <code>gb</code>. Decimal values are not supported at this time.</p><h2 class=scroll-mt-20 id=volume-configuration-reference><a class="text-black dark:text-white no-underline hover:underline" href="index.html#volume-configuration-reference">Volume configuration reference</a></h2><p>While it is possible to declare
<a class=link href="index.html#volumes">volumes</a> on the fly as part of the
service declaration, this section allows you to create named volumes that can be
reused across multiple services (without relying on <code>volumes_from</code>), and are
easily retrieved and inspected using the docker command line or API.
See the
<a class=link href="../../../reference/cli/docker/volume/create/index.html">docker volume</a>
subcommand documentation for more information.</p><p>See
<a class=link href="../../../storage/volumes/index.html">use volumes</a> and
<a class=link href="../../../engine/extend/plugins_volume/index.html">volume
plugins</a> for general information on volumes.</p><p>Here's an example of a two-service setup where a database's data directory is
shared with another service as a volume so that it can be periodically backed
up:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKCnNlcnZpY2VzOgogIGRiOgogICAgaW1hZ2U6IGRiCiAgICB2b2x1bWVzOgogICAgICAtIGRhdGEtdm9sdW1lOi92YXIvbGliL2RiCiAgYmFja3VwOgogICAgaW1hZ2U6IGJhY2t1cC1zZXJ2aWNlCiAgICB2b2x1bWVzOgogICAgICAtIGRhdGEtdm9sdW1lOi92YXIvbGliL2JhY2t1cC9kYXRhCgp2b2x1bWVzOgogIGRhdGEtdm9sdW1lOg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>db</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>data-volume:/var/lib/db</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>backup</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>backup-service</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>data-volume:/var/lib/backup/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=l>data-volume:</span></span></span></code></pre></div></div></div><p>An entry under the top-level <code>volumes</code> key can be empty, in which case it
uses the default driver configured by the Engine (in most cases, this is the
<code>local</code> driver). Optionally, you can configure it with the following keys:</p><h3 class=scroll-mt-20 id=driver><a class="text-black dark:text-white no-underline hover:underline" href="index.html#driver">driver</a></h3><p>Specify which volume driver should be used for this volume. Defaults to whatever
driver the Docker Engine has been configured to use, which in most cases is
<code>local</code>. If the driver is not available, the Engine returns an error when
<code>docker-compose up</code> tries to create the volume.</p><div class="group relative"><button x-data="{ code: 'ZHJpdmVyOiBmb29iYXI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>foobar</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=driver_opts><a class="text-black dark:text-white no-underline hover:underline" href="index.html#driver_opts">driver_opts</a></h3><p>Specify a list of options as key-value pairs to pass to the driver for this
volume. Those options are driver-dependent - consult the driver's
documentation for more information. Optional.</p><div class="group relative"><button x-data="{ code: 'dm9sdW1lczoKICBleGFtcGxlOgogICAgZHJpdmVyX29wdHM6CiAgICAgIHR5cGU6ICJuZnMiCiAgICAgIG86ICJhZGRyPTEwLjQwLjAuMTk5LG5vbG9jayxzb2Z0LHJ3IgogICAgICBkZXZpY2U6ICI6L2RvY2tlci9leGFtcGxlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>example</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>driver_opts</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>type</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;nfs&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>o</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;addr=10.40.0.199,nolock,soft,rw&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>device</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;:/docker/example&#34;</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=external><a class="text-black dark:text-white no-underline hover:underline" href="index.html#external">external</a></h3><p>If set to <code>true</code>, specifies that this volume has been created outside of
Compose. <code>docker-compose up</code> does not attempt to create it, and raises
an error if it doesn't exist.</p><p>For version 3.3 and below of the format, <code>external</code> cannot be used in
conjunction with other volume configuration keys (<code>driver</code>, <code>driver_opts</code>,
<code>labels</code>). This limitation no longer exists for
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> and above.</p><p>In the example below, instead of attempting to create a volume called
<code>[projectname]_data</code>, Compose looks for an existing volume simply
called <code>data</code> and mount it into the <code>db</code> service's containers.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKCnNlcnZpY2VzOgogIGRiOgogICAgaW1hZ2U6IHBvc3RncmVzCiAgICB2b2x1bWVzOgogICAgICAtIGRhdGE6L3Zhci9saWIvcG9zdGdyZXNxbC9kYXRhCgp2b2x1bWVzOgogIGRhdGE6CiAgICBleHRlcm5hbDogdHJ1ZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>postgres</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>data:/var/lib/postgresql/data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>data</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><blockquote class=important><p>Deprecated in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format.</p><p>external.name was deprecated in version 3.4 file format use <code>name</code> instead.</p></blockquote><p>You can also specify the name of the volume separately from the name used to
refer to it within the Compose file:</p><div class="group relative"><button x-data="{ code: 'dm9sdW1lczoKICBkYXRhOgogICAgZXh0ZXJuYWw6CiAgICAgIG5hbWU6IGFjdHVhbC1uYW1lLW9mLXZvbHVtZQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>data</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>actual-name-of-volume</span></span></span></code></pre></div></div></div><blockquote class=important><p>Note when using docker stack deploy</p><p>External volumes that do not exist <em>are created</em> if you use
<a class=link href="index.html#deploy">docker stack deploy</a>
to launch the app in <a class=link href="../../../engine/swarm/index.html">swarm mode</a> (instead of
<a class=link href="../../../reference/cli/docker/compose/up/index.html">docker compose up</a>). In swarm mode, a volume is
automatically created when it is defined by a service. As service tasks are
scheduled on new nodes,
<a class=link href=https://github.com/docker/swarmkit/blob/master/README.md target=_blank rel=noopener>swarmkit<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
creates the volume on the local node. To learn more, see
<a class=link href=https://github.com/moby/moby/issues/29976 target=_blank rel=noopener>moby/moby#29976<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p></blockquote><h3 class=scroll-mt-20 id=labels-3><a class="text-black dark:text-white no-underline hover:underline" href="index.html#labels-3">labels</a></h3><p>Add metadata to containers using
<a class=link href="../../../engine/userguide/labels-custom-metadata/index.html">Docker labels</a>. You can use either
an array or a dictionary.</p><p>It's recommended that you use reverse-DNS notation to prevent your labels from
conflicting with those used by other software.</p><div class="group relative"><button x-data="{ code: 'bGFiZWxzOgogIGNvbS5leGFtcGxlLmRlc2NyaXB0aW9uOiAiRGF0YWJhc2Ugdm9sdW1lIgogIGNvbS5leGFtcGxlLmRlcGFydG1lbnQ6ICJJVC9PcHMiCiAgY29tLmV4YW1wbGUubGFiZWwtd2l0aC1lbXB0eS12YWx1ZTogIiI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.description</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Database volume&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.department</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;IT/Ops&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.label-with-empty-value</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bGFiZWxzOgogIC0gImNvbS5leGFtcGxlLmRlc2NyaXB0aW9uPURhdGFiYXNlIHZvbHVtZSIKICAtICJjb20uZXhhbXBsZS5kZXBhcnRtZW50PUlUL09wcyIKICAtICJjb20uZXhhbXBsZS5sYWJlbC13aXRoLWVtcHR5LXZhbHVlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.description=Database volume&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.department=IT/Ops&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.label-with-empty-value&#34;</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=name><a class="text-black dark:text-white no-underline hover:underline" href="index.html#name">name</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format.</p></blockquote><p>Set a custom name for this volume. The name field can be used to reference
volumes that contain special characters. The name is used as is
and will <strong>not</strong> be scoped with the stack name.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKdm9sdW1lczoKICBkYXRhOgogICAgbmFtZTogbXktYXBwLWRhdGE=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>data</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>my-app-data</span></span></span></code></pre></div></div></div><p>It can also be used in conjunction with the <code>external</code> property:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKdm9sdW1lczoKICBkYXRhOgogICAgZXh0ZXJuYWw6IHRydWUKICAgIG5hbWU6IG15LWFwcC1kYXRh', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>data</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>my-app-data</span></span></span></code></pre></div></div></div><h2 class=scroll-mt-20 id=network-configuration-reference><a class="text-black dark:text-white no-underline hover:underline" href="index.html#network-configuration-reference">Network configuration reference</a></h2><p>The top-level <code>networks</code> key lets you specify networks to be created.</p><ul><li>For a full explanation of Compose's use of Docker networking features and all
network driver options, see the
<a class=link href="../../networking/index.html">Networking guide</a>.</li><li>For
<a class=link href=https://github.com/docker/labs/blob/master/README.md target=_blank rel=noopener>Docker Labs<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>
tutorials on networking, start with
<a class=link href=https://github.com/docker/labs/blob/master/networking/README.md target=_blank rel=noopener>Designing Scalable, Portable Docker Container Networks<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a></li></ul><h3 class=scroll-mt-20 id=driver-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#driver-1">driver</a></h3><p>Specify which driver should be used for this network.</p><p>The default driver depends on how the Docker Engine you're using is configured,
but in most instances it is <code>bridge</code> on a single host and <code>overlay</code> on a
Swarm.</p><p>The Docker Engine returns an error if the driver is not available.</p><div class="group relative"><button x-data="{ code: 'ZHJpdmVyOiBvdmVybGF5', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>overlay</span></span></span></code></pre></div></div></div><h4 class=scroll-mt-20 id=bridge><a class="text-black dark:text-white no-underline hover:underline" href="index.html#bridge">bridge</a></h4><p>Docker defaults to using a <code>bridge</code> network on a single host. For examples of
how to work with bridge networks, see the Docker Labs tutorial on
<a class=link href=https://github.com/docker/labs/blob/master/networking/A2-bridge-networking.md target=_blank rel=noopener>Bridge networking<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p><h4 class=scroll-mt-20 id=overlay><a class="text-black dark:text-white no-underline hover:underline" href="index.html#overlay">overlay</a></h4><p>The <code>overlay</code> driver creates a named network across multiple nodes in a
<a class=link href="../../../engine/swarm/index.html">swarm</a>.</p><ul><li><p>For a working example of how to build and use an
<code>overlay</code> network with a service in swarm mode, see the Docker Labs tutorial on
<a class=link href=https://github.com/docker/labs/blob/master/networking/A3-overlay-networking.md target=_blank rel=noopener>Overlay networking and service discovery<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p></li><li><p>For an in-depth look at how it works under the hood, see the
networking concepts lab on the
<a class=link href=https://github.com/docker/labs/blob/master/networking/concepts/06-overlay-networks.md target=_blank rel=noopener>Overlay Driver Network Architecture<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.</p></li></ul><h4 class=scroll-mt-20 id=host-or-none><a class="text-black dark:text-white no-underline hover:underline" href="index.html#host-or-none">host or none</a></h4><p>Use the host's networking stack, or no networking. Equivalent to
<code>docker run --net=host</code> or <code>docker run --net=none</code>. Only used if you use
<code>docker stack</code> commands. If you use the <code>docker-compose</code> command,
use
<a class=link href="index.html#network_mode">network_mode</a> instead.</p><p>If you want to use a particular network on a common build, use <code>network</code> as
mentioned in the second yaml file example.</p><p>The syntax for using built-in networks such as <code>host</code> and <code>none</code> is a little
different. Define an external network with the name <code>host</code> or <code>none</code> (that
Docker has already created automatically) and an alias that Compose can use
(<code>hostnet</code> or <code>nonet</code> in the following examples), then grant the service access to that
network using the alias.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKc2VydmljZXM6CiAgd2ViOgogICAgbmV0d29ya3M6CiAgICAgIGhvc3RuZXQ6IHt9CgpuZXR3b3JrczoKICBob3N0bmV0OgogICAgZXh0ZXJuYWw6IHRydWUKICAgIG5hbWU6IGhvc3Q=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>hostnet</span><span class=p>:</span><span class=w> </span>{}<span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>hostnet</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>host</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'c2VydmljZXM6CiAgd2ViOgogICAgLi4uCiAgICBidWlsZDoKICAgICAgLi4uCiAgICAgIG5ldHdvcms6IGhvc3QKICAgICAgY29udGV4dDogLgogICAgICAuLi4=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=l>...</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>build</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=l>...</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>network</span><span class=p>:</span><span class=w> </span><span class=l>host</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>context</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=l>...</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'c2VydmljZXM6CiAgd2ViOgogICAgLi4uCiAgICBuZXR3b3JrczoKICAgICAgbm9uZXQ6IHt9CgpuZXR3b3JrczoKICBub25ldDoKICAgIGV4dGVybmFsOiB0cnVlCiAgICBuYW1lOiBub25l', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=l>...</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>nonet</span><span class=p>:</span><span class=w> </span>{}<span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>nonet</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>none</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=driver_opts-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#driver_opts-1">driver_opts</a></h3><p>Specify a list of options as key-value pairs to pass to the driver for this
network. Those options are driver-dependent - consult the driver's
documentation for more information. Optional.</p><div class="group relative"><button x-data="{ code: 'ZHJpdmVyX29wdHM6CiAgZm9vOiAiYmFyIgogIGJhejogMQ==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>driver_opts</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>foo</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;bar&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>baz</span><span class=p>:</span><span class=w> </span><span class=m>1</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=attachable><a class="text-black dark:text-white no-underline hover:underline" href="index.html#attachable">attachable</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-32">version 3.2</a> file format.</p></blockquote><p>Only used when the <code>driver</code> is set to <code>overlay</code>. If set to <code>true</code>, then
standalone containers can attach to this network, in addition to services. If a
standalone container attaches to an overlay network, it can communicate with
services and standalone containers that are also attached to the overlay
network from other Docker daemons.</p><div class="group relative"><button x-data="{ code: 'bmV0d29ya3M6CiAgbXluZXQxOgogICAgZHJpdmVyOiBvdmVybGF5CiAgICBhdHRhY2hhYmxlOiB0cnVl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>mynet1</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>overlay</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>attachable</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=enable_ipv6><a class="text-black dark:text-white no-underline hover:underline" href="index.html#enable_ipv6">enable_ipv6</a></h3><p>Enable IPv6 networking on this network.</p><blockquote class=warning><p>Not supported in Compose File version 3</p><p><code>enable_ipv6</code> requires you to use a version 2 Compose file, as this directive
is not yet supported in Swarm mode.</p></blockquote><h3 class=scroll-mt-20 id=ipam><a class="text-black dark:text-white no-underline hover:underline" href="index.html#ipam">ipam</a></h3><p>Specify custom IPAM config. This is an object with several properties, each of
which is optional:</p><ul><li><code>driver</code>: Custom IPAM driver, instead of the default.</li><li><code>config</code>: A list with zero or more config blocks, each containing any of
the following keys:<ul><li><code>subnet</code>: Subnet in CIDR format that represents a network segment</li></ul></li></ul><p>A full example:</p><div class="group relative"><button x-data="{ code: 'aXBhbToKICBkcml2ZXI6IGRlZmF1bHQKICBjb25maWc6CiAgICAtIHN1Ym5ldDogMTcyLjI4LjAuMC8xNg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>ipam</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>default</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=nt>subnet</span><span class=p>:</span><span class=w> </span><span class=m>172.28.0.0</span><span class=l>/16</span></span></span></code></pre></div></div></div><blockquote><p><strong>Note</strong></p><p>Additional IPAM configurations, such as <code>gateway</code>, are only honored for version 2 at the moment.</p></blockquote><h3 class=scroll-mt-20 id=internal><a class="text-black dark:text-white no-underline hover:underline" href="index.html#internal">internal</a></h3><p>By default, Docker also connects a bridge network to it to provide external
connectivity. If you want to create an externally isolated overlay network,
you can set this option to <code>true</code>.</p><h3 class=scroll-mt-20 id=labels-4><a class="text-black dark:text-white no-underline hover:underline" href="index.html#labels-4">labels</a></h3><p>Add metadata to containers using
<a class=link href="../../../engine/userguide/labels-custom-metadata/index.html">Docker labels</a>. You can use either
an array or a dictionary.</p><p>It's recommended that you use reverse-DNS notation to prevent your labels from
conflicting with those used by other software.</p><div class="group relative"><button x-data="{ code: 'bGFiZWxzOgogIGNvbS5leGFtcGxlLmRlc2NyaXB0aW9uOiAiRmluYW5jaWFsIHRyYW5zYWN0aW9uIG5ldHdvcmsiCiAgY29tLmV4YW1wbGUuZGVwYXJ0bWVudDogIkZpbmFuY2UiCiAgY29tLmV4YW1wbGUubGFiZWwtd2l0aC1lbXB0eS12YWx1ZTogIiI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.description</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Financial transaction network&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.department</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;Finance&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>com.example.label-with-empty-value</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;&#34;</span></span></span></code></pre></div></div></div><div class="group relative"><button x-data="{ code: 'bGFiZWxzOgogIC0gImNvbS5leGFtcGxlLmRlc2NyaXB0aW9uPUZpbmFuY2lhbCB0cmFuc2FjdGlvbiBuZXR3b3JrIgogIC0gImNvbS5leGFtcGxlLmRlcGFydG1lbnQ9RmluYW5jZSIKICAtICJjb20uZXhhbXBsZS5sYWJlbC13aXRoLWVtcHR5LXZhbHVlIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>labels</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.description=Financial transaction network&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.department=Finance&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span>- <span class=s2>&#34;com.example.label-with-empty-value&#34;</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=external-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#external-1">external</a></h3><p>If set to <code>true</code>, specifies that this network has been created outside of
Compose. <code>docker-compose up</code> does not attempt to create it, and raises
an error if it doesn't exist.</p><p>For version 3.3 and below of the format, <code>external</code> cannot be used in
conjunction with other network configuration keys (<code>driver</code>, <code>driver_opts</code>,
<code>ipam</code>, <code>internal</code>). This limitation no longer exists for
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> and above.</p><p>In the example below, <code>proxy</code> is the gateway to the outside world. Instead of
attempting to create a network called <code>[projectname]_outside</code>, Compose
looks for an existing network simply called <code>outside</code> and connect the <code>proxy</code>
service's containers to it.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKCnNlcnZpY2VzOgogIHByb3h5OgogICAgYnVpbGQ6IC4vcHJveHkKICAgIG5ldHdvcmtzOgogICAgICAtIG91dHNpZGUKICAgICAgLSBkZWZhdWx0CiAgYXBwOgogICAgYnVpbGQ6IC4vYXBwCiAgICBuZXR3b3JrczoKICAgICAgLSBkZWZhdWx0CgpuZXR3b3JrczoKICBvdXRzaWRlOgogICAgZXh0ZXJuYWw6IHRydWU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>proxy</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>build</span><span class=p>:</span><span class=w> </span><span class=l>./proxy</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>outside</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>default</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>app</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>build</span><span class=p>:</span><span class=w> </span><span class=l>./app</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span>- <span class=l>default</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>outside</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><blockquote class=important><p>Deprecated in
<a class=link href="../compose-versioning/index.html#version-35">version 3.5</a> file format.</p><p>external.name was deprecated in version 3.5 file format use <code>name</code> instead.</p></blockquote><p>You can also specify the name of the network separately from the name used to
refer to it within the Compose file:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKbmV0d29ya3M6CiAgb3V0c2lkZToKICAgIGV4dGVybmFsOgogICAgICBuYW1lOiBhY3R1YWwtbmFtZS1vZi1uZXR3b3Jr', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>outside</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>actual-name-of-network</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=name-1><a class="text-black dark:text-white no-underline hover:underline" href="index.html#name-1">name</a></h3><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-35">version 3.5</a> file format.</p></blockquote><p>Set a custom name for this network. The name field can be used to reference
networks which contain special characters. The name is used as is
and will <strong>not</strong> be scoped with the stack name.</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKbmV0d29ya3M6CiAgbmV0d29yazE6CiAgICBuYW1lOiBteS1hcHAtbmV0', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>network1</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>my-app-net</span></span></span></code></pre></div></div></div><p>It can also be used in conjunction with the <code>external</code> property:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKbmV0d29ya3M6CiAgbmV0d29yazE6CiAgICBleHRlcm5hbDogdHJ1ZQogICAgbmFtZTogbXktYXBwLW5ldA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>networks</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>network1</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>my-app-net</span></span></span></code></pre></div></div></div><h2 class=scroll-mt-20 id=configs-configuration-reference><a class="text-black dark:text-white no-underline hover:underline" href="index.html#configs-configuration-reference">configs configuration reference</a></h2><p>The top-level <code>configs</code> declaration defines or references
<a class=link href="../../../engine/swarm/configs/index.html">configs</a> that can be granted to the services in
this stack. The source of the config is either <code>file</code> or <code>external</code>.</p><ul><li><code>file</code>: The config is created with the contents of the file at the specified
path.</li><li><code>external</code>: If set to true, specifies that this config has already been
created. Docker does not attempt to create it, and if it does not exist, a
<code>config not found</code> error occurs.</li><li><code>name</code>: The name of the config object in Docker. This field can be used to
reference configs that contain special characters. The name is used as is
and will <strong>not</strong> be scoped with the stack name. Introduced in version 3.5
file format.</li><li><code>driver</code> and <code>driver_opts</code>: The name of a custom secret driver, and driver-specific
options passed as key/value pairs. Introduced in version 3.8 file format, and
only supported when using <code>docker stack</code>.</li><li><code>template_driver</code>: The name of the templating driver to use, which controls
whether and how to evaluate the secret payload as a template. If no driver
is set, no templating is used. The only driver currently supported is <code>golang</code>,
which uses a <code>golang</code>. Introduced in version 3.8 file format, and only supported
when using <code>docker stack</code>. Refer to
<a class=link href="../../../engine/swarm/configs/index.html#example-use-a-templated-config">use a templated config</a>
for a examples of templated configs.</li></ul><p>In this example, <code>my_first_config</code> is created (as
<code>&lt;stack_name>_my_first_config)</code>when the stack is deployed,
and <code>my_second_config</code> already exists in Docker.</p><div class="group relative"><button x-data="{ code: 'Y29uZmlnczoKICBteV9maXJzdF9jb25maWc6CiAgICBmaWxlOiAuL2NvbmZpZ19kYXRhCiAgbXlfc2Vjb25kX2NvbmZpZzoKICAgIGV4dGVybmFsOiB0cnVl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_first_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./config_data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_second_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><p>Another variant for external configs is when the name of the config in Docker
is different from the name that exists within the service. The following
example modifies the previous one to use the external config called
<code>redis_config</code>.</p><div class="group relative"><button x-data="{ code: 'Y29uZmlnczoKICBteV9maXJzdF9jb25maWc6CiAgICBmaWxlOiAuL2NvbmZpZ19kYXRhCiAgbXlfc2Vjb25kX2NvbmZpZzoKICAgIGV4dGVybmFsOgogICAgICBuYW1lOiByZWRpc19jb25maWc=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>configs</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_first_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./config_data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_second_config</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>redis_config</span></span></span></code></pre></div></div></div><p>You still need to
<a class=link href="index.html#configs">grant access to the config</a> to each service in the
stack.</p><h2 class=scroll-mt-20 id=secrets-configuration-reference><a class="text-black dark:text-white no-underline hover:underline" href="index.html#secrets-configuration-reference">secrets configuration reference</a></h2><p>The top-level <code>secrets</code> declaration defines or references
<a class=link href="../../../engine/swarm/secrets/index.html">secrets</a> that can be granted to the services in
this stack. The source of the secret is either <code>file</code> or <code>external</code>.</p><ul><li><code>file</code>: The secret is created with the contents of the file at the specified
path.</li><li><code>external</code>: If set to true, specifies that this secret has already been
created. Docker does not attempt to create it, and if it does not exist, a
<code>secret not found</code> error occurs.</li><li><code>name</code>: The name of the secret object in Docker. This field can be used to
reference secrets that contain special characters. The name is used as is
and will <strong>not</strong> be scoped with the stack name. Introduced in version 3.5
file format.</li><li><code>template_driver</code>: The name of the templating driver to use, which controls
whether and how to evaluate the secret payload as a template. If no driver
is set, no templating is used. The only driver currently supported is <code>golang</code>,
which uses a <code>golang</code>. Introduced in version 3.8 file format, and only
supported when using <code>docker stack</code>.</li></ul><p>In this example, <code>my_first_secret</code> is created as
<code>&lt;stack_name>_my_first_secret</code> when the stack is deployed,
and <code>my_second_secret</code> already exists in Docker.</p><div class="group relative"><button x-data="{ code: 'c2VjcmV0czoKICBteV9maXJzdF9zZWNyZXQ6CiAgICBmaWxlOiAuL3NlY3JldF9kYXRhCiAgbXlfc2Vjb25kX3NlY3JldDoKICAgIGV4dGVybmFsOiB0cnVl', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>secrets</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_first_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./secret_data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_second_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span></span></span></code></pre></div></div></div><p>Another variant for external secrets is when the name of the secret in Docker
is different from the name that exists within the service. The following
example modifies the previous one to use the external secret called
<code>redis_secret</code>.</p><h3 class=scroll-mt-20 id=compose-file-v35-and-above><a class="text-black dark:text-white no-underline hover:underline" href="index.html#compose-file-v35-and-above">Compose File v3.5 and above</a></h3><div class="group relative"><button x-data="{ code: 'c2VjcmV0czoKICBteV9maXJzdF9zZWNyZXQ6CiAgICBmaWxlOiAuL3NlY3JldF9kYXRhCiAgbXlfc2Vjb25kX3NlY3JldDoKICAgIGV4dGVybmFsOiB0cnVlCiAgICBuYW1lOiByZWRpc19zZWNyZXQ=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>secrets</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_first_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>file</span><span class=p>:</span><span class=w> </span><span class=l>./secret_data</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>my_second_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w> </span><span class=kc>true</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>redis_secret</span></span></span></code></pre></div></div></div><h3 class=scroll-mt-20 id=compose-file-v34-and-under><a class="text-black dark:text-white no-underline hover:underline" href="index.html#compose-file-v34-and-under">Compose File v3.4 and under</a></h3><div class="group relative"><button x-data="{ code: 'ICBteV9zZWNvbmRfc2VjcmV0OgogICAgZXh0ZXJuYWw6CiAgICAgIG5hbWU6IHJlZGlzX3NlY3JldA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=w>  </span><span class=nt>my_second_secret</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>external</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>      </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>redis_secret</span></span></span></code></pre></div></div></div><p>You still need to
<a class=link href="index.html#secrets">grant access to the secrets</a> to each service in the
stack.</p><h2 class=scroll-mt-20 id=variable-substitution><a class="text-black dark:text-white no-underline hover:underline" href="index.html#variable-substitution">Variable substitution</a></h2><p>Your configuration options can contain environment variables. Compose uses the
variable values from the shell environment in which <code>docker compose</code> is run. For
example, suppose the shell contains <code>POSTGRES_VERSION=9.3</code> and you supply this
configuration:</p><div class="group relative"><button x-data="{ code: 'ZGI6CiAgaW1hZ2U6ICJwb3N0Z3Jlczoke1BPU1RHUkVTX1ZFUlNJT059Ig==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;postgres:${POSTGRES_VERSION}&#34;</span></span></span></code></pre></div></div></div><p>When you run <code>docker compose up</code> with this configuration, Compose looks for the
<code>POSTGRES_VERSION</code> environment variable in the shell and substitutes its value
in. For this example, Compose resolves the <code>image</code> to <code>postgres:9.3</code> before
running the configuration.</p><p>If an environment variable is not set, Compose substitutes with an empty
string. In the example above, if <code>POSTGRES_VERSION</code> is not set, the value for
the <code>image</code> option is <code>postgres:</code>.</p><p>You can set default values for environment variables using a
<a class=link href="../../env-file/index.html"><code>.env</code> file</a>, which Compose automatically looks for in
project directory (parent folder of your Compose file).
Values set in the shell environment override those set in the <code>.env</code> file.</p><blockquote class=important><p>Note when using docker stack deploy</p><p>The <code>.env file</code> feature only works when you use the <code>docker compose up</code> command
and does not work with <code>docker stack deploy</code>.</p></blockquote><p>Both <code>$VARIABLE</code> and <code>${VARIABLE}</code> syntax are supported. Additionally when using
the
<a class=link href="../compose-versioning/index.html#version-21">2.1 file format</a>, it is possible to
provide inline default values using typical shell syntax:</p><ul><li><code>${VARIABLE:-default}</code> evaluates to <code>default</code> if <code>VARIABLE</code> is unset or
empty in the environment.</li><li><code>${VARIABLE-default}</code> evaluates to <code>default</code> only if <code>VARIABLE</code> is unset
in the environment.</li></ul><p>Similarly, the following syntax allows you to specify mandatory variables:</p><ul><li><code>${VARIABLE:?err}</code> exits with an error message containing <code>err</code> if
<code>VARIABLE</code> is unset or empty in the environment.</li><li><code>${VARIABLE?err}</code> exits with an error message containing <code>err</code> if
<code>VARIABLE</code> is unset in the environment.</li></ul><p>Other extended shell-style features, such as <code>${VARIABLE/foo/bar}</code>, are not
supported.</p><p>You can use a <code>$$</code> (double-dollar sign) when your configuration needs a literal
dollar sign. This also prevents Compose from interpolating a value, so a <code>$$</code>
allows you to refer to environment variables that you don't want processed by
Compose.</p><div class="group relative"><button x-data="{ code: 'd2ViOgogIGJ1aWxkOiAuCiAgY29tbWFuZDogIiQkVkFSX05PVF9JTlRFUlBPTEFURURfQllfQ09NUE9TRSI=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>build</span><span class=p>:</span><span class=w> </span><span class=l>.</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>command</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;$$VAR_NOT_INTERPOLATED_BY_COMPOSE&#34;</span></span></span></code></pre></div></div></div><p>If you forget and use a single dollar sign (<code>$</code>), Compose interprets the value
as an environment variable and warns you:</p><div class="group relative"><button x-data="{ code: 'VGhlIFZBUl9OT1RfSU5URVJQT0xBVEVEX0JZX0NPTVBPU0UgaXMgbm90IHNldC4gU3Vic3RpdHV0aW5nIGFuIGVtcHR5IHN0cmluZy4=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=go>The VAR_NOT_INTERPOLATED_BY_COMPOSE is not set. Substituting an empty string.
</span></span></span></code></pre></div></div></div><h2 class=scroll-mt-20 id=extension-fields><a class="text-black dark:text-white no-underline hover:underline" href="index.html#extension-fields">Extension fields</a></h2><blockquote><p>Added in
<a class=link href="../compose-versioning/index.html#version-34">version 3.4</a> file format.</p></blockquote><p>It is possible to re-use configuration fragments using extension fields. Those
special fields can be of any format as long as they are located at the root of
your Compose file and their name start with the <code>x-</code> character sequence.</p><blockquote><p><strong>Note</strong></p><p>Starting with the 3.7 format (for the 3.x series) and 2.4 format
(for the 2.x series), extension fields are also allowed at the root
of service, volume, network, config and secret definitions.</p></blockquote><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKeC1jdXN0b206CiAgaXRlbXM6CiAgICAtIGEKICAgIC0gYgogIG9wdGlvbnM6CiAgICBtYXgtc2l6ZTogJzEybScKICBuYW1lOiAiY3VzdG9tIg==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>x-custom</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>items</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=l>a</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span>- <span class=l>b</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>max-size</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;12m&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;custom&#34;</span></span></span></code></pre></div></div></div><p>The contents of those fields are ignored by Compose, but they can be
inserted in your resource definitions using
<a class=link href=https://yaml.org/spec/1.2/spec.html#id2765878 target=_blank rel=noopener>YAML anchors<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>.
For example, if you want several of your services to use the same logging
configuration:</p><div class="group relative"><button x-data="{ code: 'bG9nZ2luZzoKICBvcHRpb25zOgogICAgbWF4LXNpemU6ICcxMm0nCiAgICBtYXgtZmlsZTogJzUnCiAgZHJpdmVyOiBqc29uLWZpbGU=', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>logging</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>max-size</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;12m&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>max-file</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;5&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>json-file</span></span></span></code></pre></div></div></div><p>You may write your Compose file as follows:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKeC1sb2dnaW5nOgogICZkZWZhdWx0LWxvZ2dpbmcKICBvcHRpb25zOgogICAgbWF4LXNpemU6ICcxMm0nCiAgICBtYXgtZmlsZTogJzUnCiAgZHJpdmVyOiBqc29uLWZpbGUKCnNlcnZpY2VzOgogIHdlYjoKICAgIGltYWdlOiBteWFwcC93ZWI6bGF0ZXN0CiAgICBsb2dnaW5nOiAqZGVmYXVsdC1sb2dnaW5nCiAgZGI6CiAgICBpbWFnZTogbXlzcWw6bGF0ZXN0CiAgICBsb2dnaW5nOiAqZGVmYXVsdC1sb2dnaW5n', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>x-logging</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=cp>&amp;default-logging</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>options</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>max-size</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;12m&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>max-file</span><span class=p>:</span><span class=w> </span><span class=s1>&#39;5&#39;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>json-file</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>myapp/web:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>logging</span><span class=p>:</span><span class=w> </span><span class=cp>*default-logging</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>db</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>mysql:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>logging</span><span class=p>:</span><span class=w> </span><span class=cp>*default-logging</span></span></span></code></pre></div></div></div><p>It is also possible to partially override values in extension fields using
the
<a class=link href=https://yaml.org/type/merge.html target=_blank rel=noopener>YAML merge type<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a>. For example:</p><div class="group relative"><button x-data="{ code: 'dmVyc2lvbjogIjMuOCIKeC12b2x1bWVzOgogICZkZWZhdWx0LXZvbHVtZQogIGRyaXZlcjogZm9vYmFyLXN0b3JhZ2UKCnNlcnZpY2VzOgogIHdlYjoKICAgIGltYWdlOiBteWFwcC93ZWI6bGF0ZXN0CiAgICB2b2x1bWVzOiBbInZvbDEiLCAidm9sMiIsICJ2b2wzIl0Kdm9sdW1lczoKICB2b2wxOiAqZGVmYXVsdC12b2x1bWUKICB2b2wyOgogICAgPDwgOiAqZGVmYXVsdC12b2x1bWUKICAgIG5hbWU6IHZvbHVtZTAyCiAgdm9sMzoKICAgIDw8IDogKmRlZmF1bHQtdm9sdW1lCiAgICBkcml2ZXI6IGRlZmF1bHQKICAgIG5hbWU6IHZvbHVtZS1sb2NhbA==', copying: false }" class="absolute top-3 right-3 text-gray-light-300 dark:text-gray-dark-600" title=Copy @click="window.navigator.clipboard.writeText(atob(code).replaceAll(/^\$\s*/gm, ''));
    copying = true;
    setTimeout(() => copying = false, 2000);">
<span :class="{ 'group-hover:block' : !copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"/></svg></span>
<span :class="{ 'group-hover:block' : copying }" class="hidden icon-svg"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m421-389-98-98q-9-9-22-9t-23 10q-9 9-9 22t9 22l122 123q9 9 21 9t21-9l239-239q10-10 10-23t-10-23q-10-9-23.5-8.5T635-603L421-389zm59 309q-82 0-155-31.5t-127.5-86-86-127.5T80-480q0-83 31.5-156t86-127T325-848.5 480-880q83 0 156 31.5T763-763t85.5 127T880-480q0 82-31.5 155T763-197.5t-127 86T480-80z"/></svg></span></button><div class="syntax-light dark:syntax-dark"><div class=highlight><pre tabindex=0 class=chroma><code class=language-yaml data-lang=yaml><span class=line><span class=cl><span class=nt>version</span><span class=p>:</span><span class=w> </span><span class=s2>&#34;3.8&#34;</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>x-volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=cp>&amp;default-volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>foobar-storage</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>services</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>web</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>image</span><span class=p>:</span><span class=w> </span><span class=l>myapp/web:latest</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>volumes</span><span class=p>:</span><span class=w> </span><span class=p>[</span><span class=s2>&#34;vol1&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;vol2&#34;</span><span class=p>,</span><span class=w> </span><span class=s2>&#34;vol3&#34;</span><span class=p>]</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w></span><span class=nt>volumes</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>vol1</span><span class=p>:</span><span class=w> </span><span class=cp>*default-volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>vol2</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>&lt;&lt; </span><span class=p>:</span><span class=w> </span><span class=cp>*default-volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>volume02</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>  </span><span class=nt>vol3</span><span class=p>:</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>&lt;&lt; </span><span class=p>:</span><span class=w> </span><span class=cp>*default-volume</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>driver</span><span class=p>:</span><span class=w> </span><span class=l>default</span><span class=w>
</span></span></span><span class=line><span class=cl><span class=w>    </span><span class=nt>name</span><span class=p>:</span><span class=w> </span><span class=l>volume-local</span></span></span></code></pre></div></div></div><h2 class=scroll-mt-20 id=compose-documentation><a class="text-black dark:text-white no-underline hover:underline" href="index.html#compose-documentation">Compose documentation</a></h2><ul><li><a class=link href="../../index.html">User guide</a></li><li><a class=link href="../../install.html">Installing Compose</a></li><li><a class=link href="../compose-versioning/index.html">Compose file versions and upgrading</a></li><li><a class=link href="../../samples-for-compose/index.html">Sample apps with Compose</a></li><li><a class=link href="../../reference/index.html">Command line reference</a></li></ul></article></div><div class="sticky top-16 h-screen w-[300px] shrink grow overflow-y-scroll lg:hidden"><aside class="py-4 space-y-4"><p class="flex items-center gap-2"><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M150-120q-13 0-21.5-8.5T120-150v-73q0-12 5-23.5t13-19.5l557-556q8-8 19-12.5t23-4.5q11 0 22 4.5t20 12.5l44 44q9 9 13 20t4 22-4.5 22.5T823-694L266-138q-8 8-19.5 13t-23.5 5h-73zm589-577 40-40-41-41-40 40 41 41z"/></svg></span>
<a class=link target=_blank rel=noopener href=https://github.com/docker/docs/edit/main/content/compose/compose-file/compose-file-v3.md>Edit this page
<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a></p><p class="flex items-center gap-2"><span class=icon-svg><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m378-332 363-363q9.067-9 21.533-9Q775-704 784-694.947q9 9.052 9 21.5Q793-661 784-652L399-267q-9 9-21 9t-21-9L175-449q-9-9.067-8.5-21.533Q167-483 176.053-492q9.052-9 21.5-9Q210-501 219-492l159 160z"/></svg></span>
<a class=link target=_blank rel=noopener href="https://github.com/docker/docs/issues/new?template=doc_issue.yml&location=https%3a%2f%2fdocs.docker.com%2fcompose%2fcompose-file%2fcompose-file-v3%2f&labels=status%2Ftriage">Request changes
<span class="icon-svg icon-xs icon-top"><svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M180-120q-24 0-42-18t-18-42v-6e2q0-24 18-42t42-18h249q12.75.0 21.375 8.675 8.625 8.676 8.625 21.5.0 12.825-8.625 21.325T429-780H180v6e2h6e2v-249q0-12.75 8.675-21.375 8.676-8.625 21.5-8.625 12.825.0 21.325 8.625T840-429v249q0 24-18 42t-42 18H180zm6e2-617L403-360q-9 9-21 8.5t-21-9.5-9-21 9-21l377-377H549q-12.75.0-21.375-8.675-8.625-8.676-8.625-21.5.0-12.825 8.625-21.325T549-840h291v291q0 12.75-8.675 21.375-8.676 8.625-21.5 8.625-12.825.0-21.325-8.625T780-549v-188z"/></svg></span></a></a></p><div><div class="text-lg pb-2">Contents</div><nav id=TableOfContents><ul><li><a href="index.html#reference-and-guidelines">Reference and guidelines</a></li><li><a href="index.html#compose-and-docker-compatibility-matrix">Compose and Docker compatibility matrix</a></li><li><a href="index.html#compose-file-structure-and-examples">Compose file structure and examples</a></li><li><a href="index.html#service-configuration-reference">Service configuration reference</a><ul><li><a href="index.html#build">build</a></li><li><a href="index.html#cap_add-cap_drop">cap_add, cap_drop</a></li><li><a href="index.html#cgroup_parent">cgroup_parent</a></li><li><a href="index.html#command">command</a></li><li><a href="index.html#configs">configs</a></li><li><a href="index.html#container_name">container_name</a></li><li><a href="index.html#credential_spec">credential_spec</a></li><li><a href="index.html#depends_on">depends_on</a></li><li><a href="index.html#deploy">deploy</a></li><li><a href="index.html#devices">devices</a></li><li><a href="index.html#dns">dns</a></li><li><a href="index.html#dns_search">dns_search</a></li><li><a href="index.html#entrypoint">entrypoint</a></li><li><a href="index.html#env_file">env_file</a></li><li><a href="index.html#environment">environment</a></li><li><a href="index.html#expose">expose</a></li><li><a href="index.html#external_links">external_links</a></li><li><a href="index.html#extra_hosts">extra_hosts</a></li><li><a href="index.html#healthcheck">healthcheck</a></li><li><a href="index.html#image">image</a></li><li><a href="index.html#init">init</a></li><li><a href="index.html#isolation">isolation</a></li><li><a href="index.html#labels-2">labels</a></li><li><a href="index.html#links">links</a></li><li><a href="index.html#logging">logging</a></li><li><a href="index.html#network_mode">network_mode</a></li><li><a href="index.html#networks">networks</a></li><li><a href="index.html#pid">pid</a></li><li><a href="index.html#ports">ports</a></li><li><a href="index.html#profiles">profiles</a></li><li><a href="index.html#restart">restart</a></li><li><a href="index.html#secrets">secrets</a></li><li><a href="index.html#security_opt">security_opt</a></li><li><a href="index.html#stop_grace_period">stop_grace_period</a></li><li><a href="index.html#stop_signal">stop_signal</a></li><li><a href="index.html#sysctls">sysctls</a></li><li><a href="index.html#tmpfs">tmpfs</a></li><li><a href="index.html#ulimits">ulimits</a></li><li><a href="index.html#userns_mode">userns_mode</a></li><li><a href="index.html#volumes">volumes</a></li><li><a href="index.html#domainname-hostname-ipc-mac_address-privileged-read_only-shm_size-stdin_open-tty-user-working_dir">domainname, hostname, ipc, mac_address, privileged, read_only, shm_size, stdin_open, tty, user, working_dir</a></li></ul></li><li><a href="index.html#specifying-durations">Specifying durations</a></li><li><a href="index.html#specifying-byte-values">Specifying byte values</a></li><li><a href="index.html#volume-configuration-reference">Volume configuration reference</a><ul><li><a href="index.html#driver">driver</a></li><li><a href="index.html#driver_opts">driver_opts</a></li><li><a href="index.html#external">external</a></li><li><a href="index.html#labels-3">labels</a></li><li><a href="index.html#name">name</a></li></ul></li><li><a href="index.html#network-configuration-reference">Network configuration reference</a><ul><li><a href="index.html#driver-1">driver</a></li><li><a href="index.html#driver_opts-1">driver_opts</a></li><li><a href="index.html#attachable">attachable</a></li><li><a href="index.html#enable_ipv6">enable_ipv6</a></li><li><a href="index.html#ipam">ipam</a></li><li><a href="index.html#internal">internal</a></li><li><a href="index.html#labels-4">labels</a></li><li><a href="index.html#external-1">external</a></li><li><a href="index.html#name-1">name</a></li></ul></li><li><a href="index.html#configs-configuration-reference">configs configuration reference</a></li><li><a href="index.html#secrets-configuration-reference">secrets configuration reference</a><ul><li><a href="index.html#compose-file-v35-and-above">Compose File v3.5 and above</a></li><li><a href="index.html#compose-file-v34-and-under">Compose File v3.4 and under</a></li></ul></li><li><a href="index.html#variable-substitution">Variable substitution</a></li><li><a href="index.html#extension-fields">Extension fields</a></li><li><a href="index.html#compose-documentation">Compose documentation</a></li></ul></nav></div></aside></div></main><footer><div class="flex justify-center py-20 px-4 bg-gray-light-200/50 dark:bg-gray-dark-300/50"><div class="flex w-[1200px] flex-col gap-10"><div class="flex sm:flex-col gap-4 items-center justify-evenly"><a class="underline-offset-2 hover:underline" href=https://www.docker.com/>Product offerings</a>
<a class="underline-offset-2 hover:underline" href=https://www.docker.com/pricing/>Pricing</a>
<a class="underline-offset-2 hover:underline" href=https://www.docker.com/company/>About us</a>
<a class="underline-offset-2 hover:underline" href=https://www.docker.com/support/>Support</a>
<a class="underline-offset-2 hover:underline" href=https://github.com/docker/docs/blob/main/CONTRIBUTING.md>Contribute</a></div><hr class="text-divider-light dark:text-divider-dark"><div class="grid grid-cols-3 place-items-center gap-8 md:grid-cols-1"><p class=text-sm>Copyright © 2013-2024 Docker Inc. All rights reserved.</p><div class="flex gap-4"><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title="X (Twitter)" href=http://twitter.com/docker/><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M14.62 13.41l-3.3-4.62H9.56l4.09 5.72.51.72 3.51 4.91h1.76l-4.29-6.01-.52-.72z"/><path class="cls-1" d="M14.5.0A14.5 14.5.0 1029 14.5 14.5 14.5.0 0014.5.0zm2.63 20.94-3.55-5.05-4.43 5.05H8l5.07-5.77L8 7.94h3.87l3.36 4.78 4.2-4.78h1.15l-4.84 5.51L21 20.94z"/></g></g></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=LinkedIn href=https://www.linkedin.com/company/docker><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 24c6.627.0 12-5.373 12-12S18.627.0 12 0 0 5.373.0 12s5.373 12 12 12zM8.176 9.66H5.174v9.035h3.002V9.66zm-3.18-2.795c0-.885.671-1.56 1.699-1.56 1.027.0 1.66.675 1.679 1.56.0.867-.652 1.562-1.7 1.562h-.018c-1.008.0-1.66-.695-1.66-1.562zm7.845 4.074c.398-.614 1.112-1.49 2.706-1.49 1.976.0 3.457 1.29 3.457 4.065v5.18h-3.002v-4.833c0-1.214-.435-2.043-1.522-2.043-.829.0-1.323.559-1.54 1.098-.08.194-.099.463-.099.733v5.046H9.838s.04-8.187.0-9.035h3.003v1.28z"/></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=Instagram href=https://www.instagram.com/dockerinc/><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 24c6.627.0 12-5.373 12-12S18.627.0 12 0 0 5.373.0 12s5.373 12 12 12zM6.984 4.774c.485-.19 1.04-.32 1.853-.359.814-.039 1.074-.048 3.148-.052 2.075-.004 2.335.004 3.15.04.812.035 1.368.164 1.853.352.503.193.93.454 1.355.878s.687.849.883 1.35c.19.486.32 1.041.359 1.854.038.815.048 1.074.052 3.148s-.005 2.335-.04 3.15c-.036.812-.164 1.368-.352 1.854a3.737 3.737.0 01-.878 1.354 3.746 3.746.0 01-1.35.884c-.486.19-1.04.32-1.853.358-.815.039-1.075.048-3.15.052-2.073.004-2.333-.004-3.148-.04-.813-.036-1.369-.163-1.854-.351a3.746 3.746.0 01-1.355-.878 3.74 3.74.0 01-.883-1.352c-.19-.485-.32-1.04-.359-1.852-.039-.815-.048-1.075-.052-3.15-.004-2.073.004-2.333.04-3.148.036-.813.163-1.368.351-1.855.195-.502.455-.929.879-1.354a3.736 3.736.0 011.35-.883zm.523 13.189c.27.103.674.227 1.419.26.806.034 1.047.042 3.086.038 2.04-.004 2.28-.012 3.086-.05.744-.036 1.148-.16 1.417-.266.357-.14.61-.306.877-.573.267-.268.432-.522.57-.879.104-.27.228-.674.26-1.419.035-.805.043-1.047.039-3.086-.004-2.039-.012-2.28-.05-3.086-.036-.744-.16-1.149-.266-1.417a2.366 2.366.0 00-.573-.878 2.364 2.364.0 00-.88-.57c-.269-.103-.674-.227-1.418-.26-.805-.034-1.047-.042-3.086-.038-2.04.004-2.28.012-3.086.05-.744.036-1.148.16-1.417.266a2.38 2.38.0 00-.878.573 2.37 2.37.0 00-.57.88c-.103.269-.227.674-.26 1.418-.034.805-.042 1.047-.038 3.086.004 2.04.013 2.28.05 3.086.035.744.161 1.148.266 1.418.14.356.305.61.573.877.268.266.522.431.88.57zm8.563-9.131a.917.917.0 11-.003-1.833.917.917.0 01.003 1.833zm-4.063 7.09a3.921 3.921.0 11-.015-7.843 3.921 3.921.0 01.015 7.842zm-.012-6.468a2.546 2.546.0 10.01 5.092 2.546 2.546.0 00-.01-5.092z"/></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=YouTube href=http://www.youtube.com/user/dockerrun><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 24c6.627.0 12-5.373 12-12S18.627.0 12 0 0 5.373.0 12s5.373 12 12 12zm7.543-15.79a1.971 1.971.0 00-1.392-1.39C16.923 6.49 12 6.49 12 6.49s-4.924.0-6.152.33A1.972 1.972.0 004.457 8.21c-.33 1.229-.33 3.79-.33 3.79s0 2.562.33 3.79c.18.677.714 1.21 1.391 1.391 1.228.329 6.151.329 6.151.329s4.923.0 6.15-.329a1.972 1.972.0 001.393-1.392c.329-1.227.329-3.789.329-3.789s0-2.561-.33-3.79zm-9.117 6.151L14.516 12l-4.09-2.361v4.722z"/></svg>
</a><a class="h-8 w-8 rounded-full fill-blue-light dark:fill-blue-dark" title=Facebook href=https://www.facebook.com/docker.run><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.54 24c5.948-.736 10.552-5.807 10.552-11.954C24.092 5.393 18.699.0 12.046.0S0 5.393.0 12.046c0 5.842 4.158 10.712 9.677 11.813v-8.374H6.538v-3.573h3.139V9.188c0-3.098 1.845-4.81 4.669-4.81 1.352.0 2.767.242 2.767.242v3.042h-1.559c-1.536.0-2.014.953-2.014 1.93v2.32h3.428l-.548 3.573h-2.88V24z"/></svg></a></div><div class="flex items-center gap-4"><a class="underline-offset-2 hover:underline" title="Docker Terms of Service" href=https://www.docker.com/legal/docker-terms-service>Terms of Service</a>
<a class="underline-offset-2 hover:underline" title="Docker Systems Status Page" href=https://www.dockerstatus.com/>Status</a>
<a class="underline-offset-2 hover:underline" title="Docker Legal Terms" href=https://www.docker.com/legal>Legal</a></div></div></div></div></footer></body></html>